PROBLEM SOLVE LOOK LAST POST
Hi I have 12 Workboots (each for every month) name Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec
These workbookts contains something like the following
Name |
Days of Vacation |
Something Else#1 |
Something Else#2 |
Mary |
5 |
etc |
etc |
George |
3 |
|
|
John |
12 |
etc |
etc |
Gary |
13 |
etc |
etc |
I want something to loop through the months and copy all rows for mary in a summary sheet and sum the Days of Vacation from Column B in the lastrow+1
Of course I dind't come here empty handed, but I can't advance any further.
Could you help me?
Please Note that The first Workbook has some data, the 2nd Workbook is the Jan and the 13 Workbook is the Dec, the 14t is the Summary Workbook
Sub SearchForString()
Application.Calculation = xlCalculationManual
Dim LSearchRow As Integer
Dim LCopyToRow As Integer
LCopyToRow = 2
LSearchRow = 2
fname = InputBox("Input Name", "Input Name")
If fname = "" Then
While fname = ""
MsgBox ("Fatal Error")
fname = InputBox("Input Name", "Input Name")
Wend
End If
For i = 2 To 13
On Error GoTo Err_Execute
MsgBox Sheets(i).Cells(LSearchRow, 1).Value
Do While Len(Sheets(i).Cells(LSearchRow, 1).Value) > 0
If Sheets(i).Cells(LSearchRow, 2).Value = fname Then
Sheets("Summary").Range(Sheets("Summary").Cells(LCopyToRow, 1), _
Sheets("Summary").Cells(LCopyToRow, 37)) = _
Range(Sheets(i).Cells(LSearchRow, 1), _
Sheets(i).Cells(LSearchRow, 37)).Value
LCopyToRow = LCopyToRow + 1
LSearchRow = LSearchRow + 1
If i = 3 Then
MsgBox (i = 3)
End If
End If
Loop
Next i
MsgBox ("The value of the counter in the last loop was " & i)
End Sub
Bookmarks