LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default sorting data based on variable number of rows

Hello,
I am trying to create a data entry sheet which automatically sorts
itself each time it opens. It should sort according to a specific row
(D). And I want it to only sort the rows which have data in them. I
have a counter which tells me how many rows have data. I use the
snippet below which works if I already know how many rows of data I
have. In the code shown I sort down to row 300. Suppose I have a
variable named N which is equal to the number of rows. How can I get
the code to sort N rows?


Worksheets("data").Range("A2,F300").Sort
Key1:=Worksheets("data").Range("D2")

thanks,
Andrew

 
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
Sorting and grouping data with varying number or rows Vickie Excel Worksheet Functions 1 January 13th 10 09:01 PM
Chart changing based on change in data source (number of rows/colu Bal Ram Bhui, Jakarta Charts and Charting in Excel 1 November 16th 08 06:02 AM
Sorting Rows Based on data in one column AM Excel Discussion (Misc queries) 0 November 21st 07 02:53 PM
Sorting with variable number of sort fields BW Excel Programming 2 August 6th 05 07:15 PM
Copy Formula loop based on number of rows w/ data in a col B. Bernie Deitrick Excel Programming 1 August 20th 04 10:17 PM


All times are GMT +1. The time now is 11:50 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"