Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default How to add one column to a range VBA

Sorry to be so thick, but I am really struggling with how to correctly
specify ranges.
I dumped a recordset (which will have varying sizes in my application) onto
a worksheet beginning at cell A25. What I want to do is have a named range
for the results I put on the worksheet plus one additional column.

I've got the getting the results into the range down with the code below.
How do I get an extra column into the range?

Dim rng As Range
Set rng =
Worksheets("programws").Range("A25").End(xlDown).E nd(xlToRight).CurrentRegion
rng.Name = "reportcontrol"

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default How to add one column to a range VBA

Set rng = _
Worksheets("programws").Range("A25").End(xlDown).E nd(xlToRight).CurrentRegio
n
Set rng = rng.Resize(, rng.Columns.Count + 1)
rng.Name = "reportcontrol"


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"in-over-his-head-bill" wrote
in message ...
Sorry to be so thick, but I am really struggling with how to correctly
specify ranges.
I dumped a recordset (which will have varying sizes in my application)

onto
a worksheet beginning at cell A25. What I want to do is have a named range
for the results I put on the worksheet plus one additional column.

I've got the getting the results into the range down with the code below.
How do I get an extra column into the range?

Dim rng As Range
Set rng =

Worksheets("programws").Range("A25").End(xlDown).E nd(xlToRight).CurrentRegio
n
rng.Name = "reportcontrol"



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default How to add one column to a range VBA

Thanks to you both for getting me through the mental block.

"Bob Phillips" wrote:

Set rng = _
Worksheets("programws").Range("A25").End(xlDown).E nd(xlToRight).CurrentRegio
n
Set rng = rng.Resize(, rng.Columns.Count + 1)
rng.Name = "reportcontrol"


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"in-over-his-head-bill" wrote
in message ...
Sorry to be so thick, but I am really struggling with how to correctly
specify ranges.
I dumped a recordset (which will have varying sizes in my application)

onto
a worksheet beginning at cell A25. What I want to do is have a named range
for the results I put on the worksheet plus one additional column.

I've got the getting the results into the range down with the code below.
How do I get an extra column into the range?

Dim rng As Range
Set rng =

Worksheets("programws").Range("A25").End(xlDown).E nd(xlToRight).CurrentRegio
n
rng.Name = "reportcontrol"




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
AVERAGE a range in a column if another column's range equals a val bob$ Excel Discussion (Misc queries) 3 February 24th 09 07:42 AM
formula to sort a range so that it matches the exact rows of a column that is outside that range? steveo Excel Discussion (Misc queries) 1 June 18th 06 02:05 AM
How to count dates within a certain range in a column with mutiple date range entries Krisjhn Excel Worksheet Functions 2 September 1st 05 01:59 PM
CountIf first column range = "Word" and second column range <> 0 TinaMo Excel Worksheet Functions 3 June 3rd 05 10:56 PM
Transfering VBA Array Column Range to Excel Column Range ExcelMonkey[_11_] Excel Programming 5 January 22nd 04 05:57 PM


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