Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
"if" statement within a macro
I have a list of employee and when the button "update employees" is selected
I want the macro to cut and paste employess who are marked not current to another page. I don't know how to use an IF statement within a macro. Please help |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
"if" statement within a macro
Dim iLastRow As Long Dim i As Long Dim rng As Range iLastRow = Cells(Rows.Count, "A").End(xlUp).Row For i = 1 To iLastRow If Cells(i, "A").Value = "Not Current" Then If rng Is Nothing Then Set rng = Rows(i) Else Set rng = Union(rng, Rows(i)) End If End If Next i If Not rng Is Nothing Then rng.Copy Destination:=Worksheets("Sheet2").Range("A1") End If -- HTH RP (remove nothere from the email address if mailing direct) "Mili" wrote in message ... I have a list of employee and when the button "update employees" is selected I want the macro to cut and paste employess who are marked not current to another page. I don't know how to use an IF statement within a macro. Please help |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
embedding "ISERROR" function into an "IF" statement | Excel Worksheet Functions | |||
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" | Excel Discussion (Misc queries) | |||
An "If" statement coded in a macro | Excel Worksheet Functions | |||
Sending macro based e-mail with built-in "Heading" and "Text" | Excel Programming |