VBA - Transferring Information via "If - then"?

  • Thread starter Thread starter ktpack
  • Start date Start date
K

ktpack

I've been using Excel for years, but am fairly new at VB. I need hel
with a macro i'm trying to create.

I have text in one column that says one of six things: applied
submitted, etc. In the column next to that, i have a number. I wan
to move this information to different areas of the page based on wha
it says. FOr example, if it says in column A: "applied", then i want t
move the info in column B to Column C. If it says in Column A
"Submitted", then i want the info in column B to Column D. Does thi
make sense? Can anyone help? Should I be using some sort of if-the
code?

Thanks
 
Dim bFnd as Boolean

do while activeCell <> ""
bFnd = False
Select Case lcase(ActiveCell.Value)
Case "applied"
ActiveCell.offset(0,2).Value = ActiveCell.Offset(0,1).Value : bFnd =
True
Case "submitted"
ActiveCell.offset(0,3).Value = ActiveCell.Offset(0,1).Value : bFnd =
True
End Select
if bFnd then ActiveCell.Offset(0,1).ClearContents
ActiveCell.offset(1,0).Select
Loop


lcase(activeCell.Value) sees the entry in ActiveCell as all lowercase, so in
the case statement, the condition should be expressed as all lower case.

Add your additional cases.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top