Thread: Macro
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Macro

Hi,

This time we need the offset function

c.Offset(-1).Resize(2, 7).Copy

I assume that c is a Range object so imagine C is actually A10.

We offset -1 row to A9 then we resize by 2 rows and it now becomes A9:A10
and then by 7 columns to achieve what you want


--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"puiuluipui" wrote:

Hi, i have this line of code that copy 6 cells to the right. Can this be
modified to copy the cell before those 6 cells too?

dlr = Sheets("Search").Cells(Rows.Count, "a").End(xlUp).Row + 1
c.resize(, 7).Copy Sheets("Search").Cells(dlr, "a")
Sheets("search").Cells(dlr, "g") = Worksheets(sh).Name

The word this macro is searching for is in B and this is why copied range is
B:G
This code copy from range B:G.

Can this code be made to copy from range A:G?
Thanks!!