D
DA
I have the following macro that is supposed to copy one of two areas
depedning upon whehter a certain worksheet cell, whihc is range-named,
is Yes or No. Something in the syntax or dimensioning must be wrong
since it always chooses the 2nd copy range (the else condition), never
the 1st range (the then condition). Perhaps it's how I'm dimensioning
it, perhaps how I am phrasing the if statement, or perhaps you can't
use an IF statement the way I do for just the beginning of a copy
command, or perhaps I need a go to statement.
I'm sure this is trivial to fix, sincw the error is really dumb.
Thanks much!
Please help! Here is my very short macro:
Sub SetUpModelAllocationOnSummarySheet()
Dim ModelsAlreadyBuiltYesNoIndicator As Variant
If ModelsAlreadyBuiltYesNoIndicator = "No" Then
Range("AH20:AH64").Select
Selection.Copy
Else
Range("AG20:AG64").Select
Selection.Copy
End If
Range("Z20:z64").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True
End Sub
depedning upon whehter a certain worksheet cell, whihc is range-named,
is Yes or No. Something in the syntax or dimensioning must be wrong
since it always chooses the 2nd copy range (the else condition), never
the 1st range (the then condition). Perhaps it's how I'm dimensioning
it, perhaps how I am phrasing the if statement, or perhaps you can't
use an IF statement the way I do for just the beginning of a copy
command, or perhaps I need a go to statement.
I'm sure this is trivial to fix, sincw the error is really dumb.
Thanks much!
Please help! Here is my very short macro:
Sub SetUpModelAllocationOnSummarySheet()
Dim ModelsAlreadyBuiltYesNoIndicator As Variant
If ModelsAlreadyBuiltYesNoIndicator = "No" Then
Range("AH20:AH64").Select
Selection.Copy
Else
Range("AG20:AG64").Select
Selection.Copy
End If
Range("Z20:z64").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True
End Sub