Please Help!

  • Thread starter Thread starter Lacy
  • Start date Start date
L

Lacy

I've written a VB code in a macro and I keep getting a run
time error. I have reread the code several times and can't
figure out what is wrong. It may be several things I'm
kinda new to this. Would someone take a look at it and see
if you can tell what is wrong.
Thanks, Lacy

Do
Count = 1
Total = Count
For i = ActiveWorkbook.Worksheets("Sheet1").Cells(3, 10)
To ActiveWorkbooks.Worksheets("Sheet1").Cells(Rows.Count,
10).End(xlUp).Row
For j = ActiveWorkbooks.Worksheets("Sheet1").Cells(3,
11) To ActiveWorkbooks.Worksheets("Sheet1").Cells
(Rows.Count, 11).End(xlUp).Row
For k = ActiveWorkbooks.Worksheets("Sheet1").Cells(3,
34) To ActiveWorkbooks.Worksheets("Sheet1").Cells
(Rows.Count, 34).End(xlUp).Row
If i = i + 1 Then
If j = j + 1 Then
If k = k + 1 Then
Count = Count + 1
End If
End If
End If
For l = 1 To ActiveWorkbook.Sheets("Sheet1").Cells
(Rows.Count, 10).End(xlUp).Row
Total = Total + Count
Next l
Next k
Next j
Next i
Loop While ActiveWorkbook.Sheets("Sheet1").Cells
(Rows.Count, 10).End(xlUp).Row.Value <> ""
 
The code includes Activeworkbooks instead of Activeworkbook many times.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Thanks for the help. Now I'm getting Type mismatch. Got
any ideas? Thanks again, Lacy

Do
Count = 1
Total = Count
For i = ActiveWorkbook.Worksheets("Sheet1").Cells(3, 10)
To ActiveWorkbook.Worksheets("Sheet1").Cells(Rows.Count,
10).End(xlUp).Row
For j = ActiveWorkbook.Worksheets("Sheet1").Cells(3, 11)
To ActiveWorkbook.Worksheets("Sheet1").Cells(Rows.Count,
11).End(xlUp).Row
For k = ActiveWorkbook.Worksheets("Sheet1").Cells(3,
34) To ActiveWorkbook.Worksheets("Sheet1").Cells
(Rows.Count, 34).End(xlUp).Row
If i = i + 1 Then
If j = j + 1 Then
If k = k + 1 Then
Count = Count + 1
End If
End If
End If
For l = 1 To ActiveWorkbook.Sheets("Sheet1").Cells
(Rows.Count, 10).End(xlUp).Row
Total = Total + Count
Next l
Next k
Next j
Next i
Loop While ActiveWorkbook.Sheets("Sheet1").Cells
(Rows.Count, 10).End(xlUp).Row.Value <> ""
 
Back
Top