LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default macro help needed

HELP!!!! I have a macro that will go basically sheet by sheet and do a lookup
to find a date. The macro works great but takes a very long time to run and I
need to add about another 25 sheet to the end. Is there a way to write this
so it check each sheet between and run it a little faster?

Sub populate()

With Sheets("Linda Master List")
lastRow1 = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
With Sheets("ADT Test (03.16.09)")
lastRow2 = .Cells(.Rows.Count, "A").End(xlUp).Row
End With

For i = 2 To lastRow1

k = 2
For j = 2 To lastRow2
If Sheets("Linda Master List").Cells(i, 1).Value = Sheets("ADT Test
(03.16.09)").Cells(j, 1).Value Then
Sheets("Linda Master List").Cells(i, k).Value = Sheets("ADT Test
(03.16.09)").Cells(j, 2).Value
k = k + 1
End If
Next j
Next i

With Sheets("Linda Master List")
lastRow1 = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
With Sheets("PH1 WV1")
lastRow2 = .Cells(.Rows.Count, "A").End(xlUp).Row
End With

For i = 2 To lastRow1

k = 2
For j = 2 To lastRow2
If Sheets("Linda Master List").Cells(i, 1).Value = Sheets("PH1
WV1").Cells(j, 1).Value Then
Sheets("Linda Master List").Cells(i, k).Value = Sheets("PH1 WV1").Cells(j,
2).Value
k = k + 1
End If
Next j
Next i
 
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 help needed :( [email protected] Excel Worksheet Functions 2 April 7th 08 03:06 PM
Macro Help Needed :( vidguru Excel Discussion (Misc queries) 0 April 4th 08 02:43 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 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"