View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
emil emil is offline
external usenet poster
 
Posts: 49
Default Expanding selected ranges that are changing next time (with vb

Thank you for answer.
I must try it, but I think that I was not clear.
At the next run, the program selects another cells.
The procedure is more long, but I chose only a part to don't shall consume
your time.
After I try, if doesn't what I will, I shall send you an elder part from
procedure.
Don't want to disturb you overmuch.
Apologize for my very poor English.
Milion thanks
Emil
"joel" wrote:

You don't need to use select. The macro recorder uses select but it is
slower than directly addressing the range and makes the code harder to
understand. Here is some ideas

Set MyRange = Range("G1:G17)
MyRange.Copy


LastRow = Range("G" & Rows.Count).end(XLUP).Row
Set MyRange = Range("G1:G" & LastRow)
MyRange.Copy



LastRow = Range("G" & Rows.Count).end(XLUP).Row
for RowCount = 1 to LastRow step 5
'copy range from K to N
'for rows RowCount to RowCount + 4
Set MyRange= Range("K" & RowCount & ":N" & (RowCount + 4))
MyRange.Copy

Next RowCount




"emil" wrote:

Hi
Can someone help me?
In
e. g.Range ("G1:G700")
I am selected
e. g. Range ("G3:G5") .Select
and I expanded this selection with €śOffset€ť function
e. g. ActiveCell.Range("A1:A3").Select
ActiveCell.Offset(11, 0).Range("A1:D3").Select
Selection.Copy
It is OK, but next time I have other selected range
e. g. Range ("G20:G30") and the precedent €śOffset€ť is not OK.
What can I do?
Thanks for your time.
Emil