Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Add line with macro selected area

For example I have a macro that sorts data from A1 to D5. Is there a way for
this macro to pick up an extra line. Say I copied row 1, and then pasted it
under row 1, so therefore, I would want the macro to sort from A1 to D6. Is
there a way for the macro to automatically update itself, instead of me going
through all macros to update the selected range? Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,814
Default Add line with macro selected area

You could add a simple routine to count the rows. Assuming data always
present in column "A"

r=1
Do while not IsEmpty(Sheets(".......").Cells(t,1))
r=r+1
Loop
sortRange =("A1:D" & r)

"doral" wrote:

For example I have a macro that sorts data from A1 to D5. Is there a way for
this macro to pick up an extra line. Say I copied row 1, and then pasted it
under row 1, so therefore, I would want the macro to sort from A1 to D6. Is
there a way for the macro to automatically update itself, instead of me going
through all macros to update the selected range? Thank you.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 281
Default Add line with macro selected area

Hi,

enter formula below in a cell say E1 and then link the counter in your Macro
to this cell (E1):

=COUNTA(A1:A1000)

assumed column A should not be blank in your data range for example if your
datarange is A1:D100 column A Cells between this range shouldn't be blank

Thanks,
--
Farhad Hodjat


"doral" wrote:

For example I have a macro that sorts data from A1 to D5. Is there a way for
this macro to pick up an extra line. Say I copied row 1, and then pasted it
under row 1, so therefore, I would want the macro to sort from A1 to D6. Is
there a way for the macro to automatically update itself, instead of me going
through all macros to update the selected range? Thank you.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protect / Block selected worksheet area . sansk_23 Excel Discussion (Misc queries) 1 February 13th 07 12:31 PM
setting print area to selected cells [email protected] Excel Discussion (Misc queries) 4 November 30th 06 09:29 PM
Multiple pages after printing selected area Lynn Excel Discussion (Misc queries) 1 April 17th 06 04:28 PM
I want to change the selected print area but it will not allow me jeclss Excel Worksheet Functions 1 December 28th 05 11:41 PM
Capitalizing selected area J.E Excel Discussion (Misc queries) 3 March 30th 05 10:10 PM


All times are GMT +1. The time now is 08:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"