View Single Post
  #8   Report Post  
Dave Peterson
 
Posts: n/a
Default Resize Range - Macro

You want to resize it based on the xldown???

dim myRng as range
dim myRows as long

set myrng = range("myRange")
myrows = myrng.end(xldown).row - myrng.row + 1

myrng.resize(myrows,10).select

maybe??????????



Danny wrote:

I'm sorry to confuse everybody. What I'm looking for is:

run a macro to find a name(cell), then
on this active cell, the macro would resize/highlight the rows and columns
below, then
I can add another macro to either copy, format the highligted rows, columns,
insert a rows, etc.

So, how can one write a macro to make the number of rows "3" to be variable.

ActiveCell.Resize(3, 10).Select

I am looking for a macro like this but the way end.xlDown is written below
won't work!
ActiveCell.Resize(end.xlDown, 10).Select

Thanks a lot

"Dave Peterson" wrote:

I'm confused as the others, but maybe....

Dim myRng as range
with activesheet
set myrng = .range("myRange")
'this doesn't make much sense to me
'but it shows how to find the number of rows/columns in myrng
myrng.resize(myrng.rows.count,myrng.columns.count) .select
'or
'make it 10 columns wide
myrng.resize(myrng.rows.count,10).select
'which would be equivalent to:
myrng.resize(,10).select
end with

(if you specify the rows/columns to resize, then it won't be changed.)

Closer???


????? wrote:

Hi Sam,

Thanks again for your response.

Actually, what I'm looking for is how to write a macro for the variable
(xlDown)of "3" (rows) on the macro below

ActiveCell.Resize(3, 10).Select

I need this macro for a lot of things because I name a range to go to, use
the REVISED macro above, then, I can use it for a lot of things, like copy,
put borders, insert rows, etc. I have been trying to get the right macro for
this.

Thanks again.

"Sam" wrote:

? so if i understand, you want to look at the current selection, and copy
? an area 10 columns across and n rows down (n= number of used rows under
? the selection) and past in a range called 'otherrange'?:
?
? Range(ActiveCell.Range("a1"), ActiveCell.End(xlDown).Offset(0,
? 10)).Copy Range("otherrange")
?
?


--

Dave Peterson


--

Dave Peterson