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

I want to sort through a workbook using a macro but I am not very good at visual basic. I have a basic outline of the type of macro below. Could somebody help please?

The workbook contains a Summary page and a number of other worksheets. The worksheets contain information about customer deliveries. If the delivery is overdue, a cell will go red due to conditional formatting. The macro should search the workbook for overdue deliveries and copy the whole row into the summary sheet.

On open, go to Summary
Clear data from columns B to M
Go to sheet 1
If date in Column K < NOW(), copy entire row to Summary
Repeat for all cells in K that hold data
Go to sheet 2, etc etc etc
Repear Query for all sheets in workbook excluding Summary
1 blank row inserted between imported rows from different sheets

I know its asking a lot but all help is greatly appreciated. If you can help please e-mail me directly at

Thanks,
Shane
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Help with Macro

Shane,

Sorry, if you post in the NG, I answer in the NG. Here is some code

Sub UpdateSheets()
Dim sh As Worksheet
Dim i As Long
Dim j As Long
Dim iTarget As Long
Dim cLastRow As Long

Worksheets("Summary").Columns("B:M").ClearContents
For i = 1 To Worksheets.Count
If Worksheets(i).Name < "Summary" Then
With Worksheets(i)
cLastRow = .Cells(Rows.Count, "K").End(xlUp).Row
For j = 1 To cLastRow
If .Cells(j, "K").Value < "" And .Cells(j, "K").Value <
Date Then
iTarget = iTarget + 1
.Cells(j, "K").EntireRow.Copy
Destination:=Worksheets("Summary").Cells(iTarget, "A")
End If
Next j
End With
iTarget = iTarget + 1
End If
Next i
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Shane" wrote in message
...
I want to sort through a workbook using a macro but I am not very good at

visual basic. I have a basic outline of the type of macro below. Could
somebody help please?

The workbook contains a Summary page and a number of other worksheets. The

worksheets contain information about customer deliveries. If the delivery is
overdue, a cell will go red due to conditional formatting. The macro should
search the workbook for overdue deliveries and copy the whole row into the
summary sheet.

On open, go to Summary
Clear data from columns B to M
Go to sheet 1
If date in Column K < NOW(), copy entire row to Summary
Repeat for all cells in K that hold data
Go to sheet 2, etc etc etc
Repear Query for all sheets in workbook excluding Summary
1 blank row inserted between imported rows from different sheets

I know its asking a lot but all help is greatly appreciated. If you can

help please e-mail me directly at

Thanks,
Shane



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 recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 06:18 AM.

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"