Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default No of columns in range

I have a procedure with the following lines of code in it:

Range(Selection, ActiveCell.SpecialCells
(xlLastCell)).Select
Selection.ClearContents
ActiveCell.Offset(-1, 0).Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
ActiveCell.SpecialCells(xlLastCell).Select
ActiveCell.Offset(0, -36).Select
Range(Selection, Selection.End(xlUp)).Select

The "36" in the penultimate row represents, currently, the
number of columns from the column of the activecell in the
first row of code and the column of the last active cell
on the worksheet. How can I replace the "36" with some
code that represents the number of columns dynamically?

TIA
Ron
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default No of columns in range

easier would be

change
ActiveCell.Offset(0, -36).Select

to

Cells(activecell.row,1).Select

--
Regards,
Tom Ogilvy

"Ron McCormick" wrote in message
...
I have a procedure with the following lines of code in it:

Range(Selection, ActiveCell.SpecialCells
(xlLastCell)).Select
Selection.ClearContents
ActiveCell.Offset(-1, 0).Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
ActiveCell.SpecialCells(xlLastCell).Select
ActiveCell.Offset(0, -36).Select
Range(Selection, Selection.End(xlUp)).Select

The "36" in the penultimate row represents, currently, the
number of columns from the column of the activecell in the
first row of code and the column of the last active cell
on the worksheet. How can I replace the "36" with some
code that represents the number of columns dynamically?

TIA
Ron



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
Select different columns within a range Kiran Charts and Charting in Excel 0 March 8th 10 01:22 PM
Linest - different columns for x range Lori Excel Worksheet Functions 0 May 23rd 07 04:16 PM
Linest - different columns for x range SD Excel Worksheet Functions 2 May 23rd 07 01:47 PM
Sum a range of columns ? Ainsley Excel Discussion (Misc queries) 6 May 9th 06 10:43 AM
looping across columns in range? Amy Excel Discussion (Misc queries) 3 July 19th 05 08:01 PM


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