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

Debbie,

Without seeing your code it's difficult but if your copying data then
somewhere in your recorded macro you will have a line simliar to

Range("A1:A10").Select
Selection.Copy

Now this as you have discovered is a fixed range that you need to make
dynamic so first find the last row with

lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row

Then create the range and copy with this

Range("A1:A" & lastrow).Copy

Note unlike a recorded macro i did it without selecting anything
--
Mike

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


"Debbie" wrote:

I'm new at running macros and I currently use the "record macro" button. I
need to run a macro that recognizes "only populated data" in the columns so I
can copy an paste it into another worksheet. The number of rows with data in
them will change daily and I need the macro to compensate.

You can do this with a filter and only filter "non blanks" but the macro
does not adjust accordingly the next day if it record it.

Any assistance would be great!
--
Deb