How to add one column to a range VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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).End(xlToRight).CurrentRegion
rng.Name = "reportcontrol"
 
Dim rng As Range
Set rng =
Worksheets("programws").Range("A25").End(xlDown).End(xlToRight).CurrentRegion
set rng=rng.resize(rng.rows+1)
rng.Name = "reportcontrol"

"in-over-his-head-bill" <[email protected]> a
écrit dans le message de (e-mail address removed)...
 
Set rng = _
Worksheets("programws").Range("A25").End(xlDown).End(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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top