IF statements in Macros
hi
if statements
Dim r As Range
If r.Value Like "*GTS*" Then
r.Value = "GTS"
Else
If r.Value = "this" Then
r.Value = "that"
End If
End If
as to the second part, you didn't profide enought info for a reply other
than to say perhaps a loop with some if statement to id what needs to be done.
regards
FSt1
"Zak" wrote:
How do i put in IF statements in macros? i know what i want the macro to do
but cant seem to get the terminology correct, also can i put in numerous IF
statements within the same macro or do i need to create seperate modules?
an example: i want the macro to recognise that IF a cell begins with the
word GTS then it should replace it so it is only GTS. i also want to have IF
statments that say IF something = this then it should change to this. or IF
something = this then it should copy this or paste that.
i know what i want but dont know how to get it.
also, on a different note i am trying to create a macro that will build a
report based on a big spreadsheet. what is the best way to get around this as
at the moment i am just using the record macro option to record while i copy
and paste, hide etc cells to view just what is required for the report! then
format it to look nice, is there a better way to do this?
thanks in advance.
|