Related:
- VBA code for a IF Function
- Vba code to search data in excel - Guide
- Vba code to compare two excel sheets and copy differences ✓ - Forum - Excel
- Vba code to compare two excel sheets and highlight differences ✓ - Forum - Excel
- Vba code to copy data from one sheet to another based on criteria ✓ - Forum - Excel
- Vba code to delete columns based on header ✓ - Forum - Excel
4 replies
I cant get the If function to do what I want. Everytime I put a range into the code, it comes up with a error. If I work with a single cell then the below works.
If Range("B2") = 3401 Then "ERROR ON THIS LINE WHEN I PUT A RANGE IN B2:B23"
Range("C2").Select
Selection.Copy
Range("D2").Select
ActiveSheet.Paste
Range("D2").Select
EndIf
If Range("B2") = 3401 Then "ERROR ON THIS LINE WHEN I PUT A RANGE IN B2:B23"
Range("C2").Select
Selection.Copy
Range("D2").Select
ActiveSheet.Paste
Range("D2").Select
EndIf
Hi
i need to add it as part of a macro that already exists. I just cant get it to work, thats why im asking.
i need to add it as part of a macro that already exists. I just cant get it to work, thats why im asking.
May 26, 2011 at 06:29 AM
i.e. where you are typing your macro give space, I mean tab
If Range("B2") = 3401 Then
Range("C2").Select
Selection.Copy
Range("D2").Select
ActiveSheet.Paste
Range("D2").Select
EndIf
this is working I checked myself