View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
TRYING TRYING is offline
external usenet poster
 
Posts: 39
Default Relative reference? in macro

Forgot to mention that I'm using Excel 2007.


"TRYING" wrote:

I have a list of client names and locations in columns A and B respectively,
up to row 100. I recorded a macro that resorts the list by client name after
I add new data. My new data would be in rows 101 to 105.

Part of the code goes:
With ActiveWorkbook.Worksheets("ClientNames").Sort
.SetRange Range("A1:B100")
. Header . . .
. MatchCase
. etc

When recording the macro, here's how I selected the sort range--in tab
ClientNames, I went to cell A1 then clicked on the Select Current Range icon.
Did the sort and clicked on the Stop Recording button. I tried recording this
several times, clicking on the Use Relative Reference button at various
times. Didn't work. The macro limited the sort to rows 1 to 100 when I needed
it to sort rows 1 to 105.

I tried a different approach at selecting the sort range by going to cell
A1, then hitting the End and Downarrow keys to get to the last entry on the
list before clicking on the Select Current Range icon. Didn't work either.

This seems simple enough but I'm stumped. How can I make this work.

Thanks.