Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default VBA: find number of columns in named range?

In a spreadsheet, I can use '= columns(Range1)' to get the number of
columns in Range1. I'm having trouble doing this in a VBA script.

I tried 'worksheetfunction(columns(...)), but this seems to be looking
for some sort of (row,col) args.

Thanks,
George
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default VBA: find number of columns in named range?


MsgBox Range("range1").Columns.Count

"George" wrote:

In a spreadsheet, I can use '= columns(Range1)' to get the number of
columns in Range1. I'm having trouble doing this in a VBA script.

I tried 'worksheetfunction(columns(...)), but this seems to be looking
for some sort of (row,col) args.

Thanks,
George

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default find number of columns in named range?

range("A1:H10").Columns.Count

as an example


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"George" wrote in message
...
In a spreadsheet, I can use '= columns(Range1)' to get the number of
columns in Range1. I'm having trouble doing this in a VBA script.

I tried 'worksheetfunction(columns(...)), but this seems to be looking
for some sort of (row,col) args.

Thanks,
George



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default VBA: find number of columns in named range?

On Mon, 30 Apr 2007 08:56:03 -0700, Toppers
wrote:


MsgBox Range("range1").Columns.Count


Thanks. G

"George" wrote:

In a spreadsheet, I can use '= columns(Range1)' to get the number of
columns in Range1. I'm having trouble doing this in a VBA script.

I tried 'worksheetfunction(columns(...)), but this seems to be looking
for some sort of (row,col) args.

Thanks,
George


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
How to find the number of value within a range? Eric Excel Worksheet Functions 11 February 28th 07 07:24 PM
How to find the number of value within a range? Eric Excel Discussion (Misc queries) 4 February 27th 07 12:16 PM
Number of Rows & Columns in a Named Range Michael Excel Dude Excel Discussion (Misc queries) 0 September 3rd 06 11:05 PM
inserting a named range into new cells based on a named cell Peter S. Excel Discussion (Misc queries) 1 June 4th 06 03:53 AM
How to find all formulas that used a certain named range Laurence Lombard Excel Discussion (Misc queries) 2 October 25th 05 08:15 AM


All times are GMT +1. The time now is 07:48 AM.

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

About Us

"It's about Microsoft Excel"