If then statement using text that changes

  • Thread starter Thread starter LDMueller
  • Start date Start date
L

LDMueller

I'm trying to write an "If then" statement but could use
some help. If the value of the cell equals a name (text)
then I want to copy a range to another location. If the
value of the cell equals "0" (e.g. zero) then I just want
it to go to the next cell.

I can handle the copy part okay, just not the "If" part
equaling text since the text value will change all the
time.

The following is similar to what I need, but it doesn't
work.


If "C22" = "0" Then 'move to next cell
Application.Goto Reference:="D22"
Else
Application.Goto Reference:="C22"
Range("C21:C36").Select
Selection.Copy
Range("A1").Select
Application.Goto Reference:="D22"
ActiveSheet.Paste
End If

Thanks!
 
if range("c22")=0 then
range("d22").select
else
range("c22").select
end if

'above selection NOT necessary
'this is all that is needed
Range("C21:C36").Copy Range("d22")
 
Back
Top