LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Syntax got me again

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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF, THEN SYNTAX BBABBZZ Excel Worksheet Functions 5 January 12th 10 10:11 PM
Why is Access VBA syntax different from Excel syntax? cr113 Excel Programming 2 December 2nd 09 12:42 AM
vba syntax Derrick Excel Discussion (Misc queries) 11 August 5th 09 08:37 PM
Need help with syntax James Excel Programming 7 August 28th 08 07:19 PM
Syntax help! Mike Fogleman Excel Programming 20 July 30th 05 01:11 PM


All times are GMT +1. The time now is 06:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"