Looping with sheets

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hello, i am trying to do as below, but it says compile error, end with
without with? which seems silly to me but i am obviously doing something wrong

**********************************************************************
Sub PrintCode()
Dim i As Integer, c As Integer, Q As Integer
c = 0

With Sheets("MacroData")

For Q = 2 To 46
B = Cells(Q, 2).Value
End With

With Sheets("Salary ect")

For i = 1 To 10000
A = Left(Cells(i, 1), 3).Value
End With

If A = B Then
With Sheets("macrodata")
Cells(i, 5).Value = 1

End With
Next

End Sub
**********************************************************************

any help please,

thanks,

andy
 
thinki i need to explain this a bit beter, i am using two sheets, i refers to
sheet 1 and Q refers to sheet 2. I want say first Q to = 2 and then the loop
for i to run all the way through to 10000 while Q = 2 and where whats in
cells(Q , 2) and cells(i , 1) match for a 1 to be put in cells(i , 5) on
sheet 2 (Q sheet) and once the loop has reached 10000 i want the next Q to be
activated so Q=3 of i loop 1 to 10000,

any help please

thanks,

andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top