Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JT JT is offline
external usenet poster
 
Posts: 234
Default syntax error

I'm trying to select several ranges using a variable (verylastrow) at the
same time to format the items in the selection but I am having a problem. It
must be Friday because I cannot figure out the syntax error in the following
code:

Range("(A1:A & verylastrow), D1:E & verylastrow), (G1:H &
verylastrow)").Select

I'm sure it is something simple but any help would be appreciated. Thanks.
--
JT
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default syntax error

Range("A1:A" & verylastrow & ",D1:E" & verylastrow _
& ",G1:H" & verylastrow).Select


from the immediate window:

verylastrow = 10
Range("A1:A" & verylastrow & ",D1:E" & verylastrow _
& ",G1:H" & verylastrow).Select
? SELECTION.ADDRESS
$A$1:$A$10,$D$1:$E$10,$G$1:$H$10

--
Regards,
Tom Ogilvy


"JT" wrote in message
...
I'm trying to select several ranges using a variable (verylastrow) at the
same time to format the items in the selection but I am having a problem.

It
must be Friday because I cannot figure out the syntax error in the

following
code:

Range("(A1:A & verylastrow), D1:E & verylastrow), (G1:H &
verylastrow)").Select

I'm sure it is something simple but any help would be appreciated.

Thanks.
--
JT



  #3   Report Post  
Posted to microsoft.public.excel.programming
JT JT is offline
external usenet poster
 
Posts: 234
Default syntax error

Thank you very much. The macro now does exactly what I'm trying to do.
Thanks again and have a good weekend.
--
JT


"Tom Ogilvy" wrote:

Range("A1:A" & verylastrow & ",D1:E" & verylastrow _
& ",G1:H" & verylastrow).Select


from the immediate window:

verylastrow = 10
Range("A1:A" & verylastrow & ",D1:E" & verylastrow _
& ",G1:H" & verylastrow).Select
? SELECTION.ADDRESS
$A$1:$A$10,$D$1:$E$10,$G$1:$H$10

--
Regards,
Tom Ogilvy


"JT" wrote in message
...
I'm trying to select several ranges using a variable (verylastrow) at the
same time to format the items in the selection but I am having a problem.

It
must be Friday because I cannot figure out the syntax error in the

following
code:

Range("(A1:A & verylastrow), D1:E & verylastrow), (G1:H &
verylastrow)").Select

I'm sure it is something simple but any help would be appreciated.

Thanks.
--
JT




Reply
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
variable not declared error & syntax error G. Beard Excel Programming 1 October 6th 05 09:16 PM
Syntax Error help Markantesp Excel Programming 1 March 8th 05 09:51 PM
Syntax error. David McNally Excel Programming 3 April 28th 04 02:57 AM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM
Where is my syntax error? Mike Excel Programming 2 December 16th 03 10:43 PM


All times are GMT +1. The time now is 04:15 PM.

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"