Is it possible to use IF( a2=5) then select a range of cells.
if yes, what is the syntax.
Thanks
Is it possible to use IF( a2=5) then select a range of cells.
if yes, what is the syntax.
Thanks
Hi
=if(a2=5,do_this,else_do_that)
HTH
Ed
Hi,
Just to add if condtion return text add quote marks. Numbers don't require quote marks
E.g
=if(a2=5,"do_this","else_do_that")
VBA Noob
_________________________________________
![]()
![]()
Credo Elvem ipsum etian vivere
_________________________________________
A message for cross posters
Please remember to wrap code.
Forum Rules
Please add to your signature if you found this link helpful. Excel links !!!
I think I explained it wrong. Sorry.
Is it possible to use in a IF statement , if the condition is true, then copy range of cells.
Is it possible to do copy a range of cells say D2:D5 if the condition is true.
Thanks
Hi,
You can use an event macro.
Right click sheet name and select view code. Paste below into sheet.
This will copy your range if A1 = true.
Replace the bold line above if you want to copy it to a new area e.g E2![]()
Private Sub Worksheet_Change(ByVal Target As Range) If Range("A1").Value = True Then Range("D2:D5").Copy End If End Sub
![]()
Range("D2:D5").Copy Range("E2")
VBA Noob
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks