Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Selecting Columns

Hi all!

I am trying to run a program which would allow me to do the following:

I have a number that is put in Cell J2 by me or any other user. That
number denotes the number of columns away from column K that I need to
start deleting from; I will delete from there all the way up to column
AC. So, fo rexample, I have the number 5 in cell J2. This would mean I
need to start deleting from column P all the way to column AC. If the
number is 3 in J2, then I would delete from column M to column AC. I
don't know the method to select the columns based on the number. So
far I have:

NumColumn = Range("J2")
Range("K2").Select
ActiveCell.Offset(0,NumColumn)

From this point on, I don't know how to select the column I'm in after
the offset all the way to column AC. If someone can help with this, I
would be forever grateful!

Thanks in advance!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Selecting Columns

I'm sure you will get other answers more directly related to using offset;
I'd do something like the following (just because it is what I know):

NumColumn = Range("J2")
CharColumn =(Asc(UCase(NumColumn )) - 64)
Columns(CharColumn & ":AC").Select

This is aircode, so it may need some tweaking... and it will only work up to
a start column of Z; after that the CharColumn will give you ascii characters
above Z (it won't automatically wrap back around to column 'AA').

HTH,
Keith
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
Selecting Separate Columns in VBA [email protected] Excel Programming 7 June 16th 06 03:25 PM
Selecting columns PaulaO Excel Programming 2 March 6th 06 08:23 PM
Selecting Columns Shatin[_2_] Excel Programming 4 September 7th 05 01:07 PM
Selecting columns aspadda Excel Programming 1 December 9th 03 03:56 AM
Selecting Columns xnman Excel Programming 2 November 18th 03 01:52 PM


All times are GMT +1. The time now is 08:20 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"