Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default referring to columns by number

Hi All,

I can refer to one column with its number like this:

colNo = 2
Columns(colNo).Delete Shift:=xlToLeft

How can I refer to more than one columns without converting column numbers
to column letters, something like this:

colNoFrom = 2
colNoTo = 5
Columns(colNoFrom:colNoTo).Delete Shift:=xlToLeft

Thanks,
Stefi

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default referring to columns by number


Columns(colNoFrom).Resize(, ColNoTo - ColNoFrom + 1).Delete Shift:=xlToLeft


--
__________________________________
HTH

Bob

"Stefi" wrote in message
...
Hi All,

I can refer to one column with its number like this:

colNo = 2
Columns(colNo).Delete Shift:=xlToLeft

How can I refer to more than one columns without converting column numbers
to column letters, something like this:

colNoFrom = 2
colNoTo = 5
Columns(colNoFrom:colNoTo).Delete Shift:=xlToLeft

Thanks,
Stefi



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default referring to columns by number

Thanks Bob, I didn't think that it can be solved so tricky!
Stefi


€˛Bob Phillips€¯ ezt Ć*rta:


Columns(colNoFrom).Resize(, ColNoTo - ColNoFrom + 1).Delete Shift:=xlToLeft


--
__________________________________
HTH

Bob

"Stefi" wrote in message
...
Hi All,

I can refer to one column with its number like this:

colNo = 2
Columns(colNo).Delete Shift:=xlToLeft

How can I refer to more than one columns without converting column numbers
to column letters, something like this:

colNoFrom = 2
colNoTo = 5
Columns(colNoFrom:colNoTo).Delete Shift:=xlToLeft

Thanks,
Stefi




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
Referring to columns from within a macro Blobbies Excel Discussion (Misc queries) 4 August 9th 09 10:03 PM
Referring to merged columns in range object Matthew Pfluger Excel Programming 2 February 11th 08 03:10 PM
Referring to non constant columns Jill1 Excel Programming 2 October 18th 06 08:43 PM
Number of Columns Pedro Mestre Excel Discussion (Misc queries) 2 October 20th 05 11:24 AM
referring to columns/cells using numbers Masa Ito Excel Programming 6 October 3rd 04 07:27 PM


All times are GMT +1. The time now is 02:11 PM.

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"