Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 193
Default Macro to Sort

I have a macro that consolidates multiple sheets into one. I'd like to
include a code in the macro where it sorts the dates (starting in cell b2)
once the consolidation is done. The headings are in row 1, how do I write a
macro where the sort starts in cell b2?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Macro to Sort

hi
do the sort manually with the macro recorder on. the recorder will write the
code for you. after that copy the recorder code and paste it in into your
project.

regards
FSt1

"Confused" wrote:

I have a macro that consolidates multiple sheets into one. I'd like to
include a code in the macro where it sorts the dates (starting in cell b2)
once the consolidation is done. The headings are in row 1, how do I write a
macro where the sort starts in cell b2?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Macro to Sort

On 12 авг, 14:20, Confused wrote:
I have a macro that consolidates multiple sheets into one. Â*I'd like to
include a code in the macro where it sorts the dates (starting in cell b2) Â*
once the consolidation is done. Â*The headings are in row 1, how do I write a
macro where the sort starts in cell b2?


Is it possible to see your code?

Thanks
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 193
Default Macro to Sort

Will this work if I keep adding lines to the consolidated sheet? the code
generated using the macro recorder ends at the last cell where it contains a
value.

"FSt1" wrote:

hi
do the sort manually with the macro recorder on. the recorder will write the
code for you. after that copy the recorder code and paste it in into your
project.

regards
FSt1

"Confused" wrote:

I have a macro that consolidates multiple sheets into one. I'd like to
include a code in the macro where it sorts the dates (starting in cell b2)
once the consolidation is done. The headings are in row 1, how do I write a
macro where the sort starts in cell b2?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 193
Default Macro to Sort

Here is the code to where it consolidates all the individual worksheets.


Sub consolidatesheets()
Application.ScreenUpdating = False

With Sheets("Consolidated")
Rows("2:" & Cells(2, 1).End(xlDown).Row).Delete

For Each sh In ThisWorkbook.Sheets

If LCase(Left(sh.Name, 1)) = "1" Then
dlr = .Cells(Rows.Count, 1).End(xlUp).Row + 1
slr = sh.Cells(Rows.Count, 1).End(xlUp).Row
If slr 1 Then sh.Cells(2, 1).Resize(slr, 16).Copy .Cells(dlr, 1)
End If

Next sh

Columns("A:p").HorizontalAlignment = xlCenter
End With

Application.ScreenUpdating = True
End Sub

"Loop" wrote:

On 12 авг, 14:20, Confused wrote:
I have a macro that consolidates multiple sheets into one. I'd like to
include a code in the macro where it sorts the dates (starting in cell b2)
once the consolidation is done. The headings are in row 1, how do I write a
macro where the sort starts in cell b2?


Is it possible to see your code?

Thanks

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
Macro conversion from Lotus 1-2-3 to Excel (Sort Macro) cgsteel Excel Programming 8 May 3rd 08 12:58 PM
Macro to Sort Tendresse Excel Programming 6 April 16th 08 12:38 PM
Macro to sort WLMPilot Excel Programming 2 April 2nd 08 07:51 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Using Macro to sort without clicking on macro button dd Excel Discussion (Misc queries) 3 May 3rd 07 06:00 PM


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