Solved VBA loop issue

It's really strange that inttrow remains 2, it should start from line 4.

Untested, but I'd try:
Code:
' ...
    intTRow = .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0).Row
'             ^      ^   
' ...
 
Untested, but I'd try:
Code:
' ...
    intTRow = .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0).Row
'             ^      ^  
' ...
Still nothing. I think the problem is in both
If Range("S" & i).Value = "Action" Then
and inttrow

I've changed it to "I" & i > '" and i got 1 result in line 4.
 
Still nothing. I think the problem is in both
If Range("S" & i).Value = "Action" Then
and inttrow

I've changed it to "I" & i > '" and i got 1 result in line 4.
No the source works out fine, just that you keep putting the data in the same place.
 
Last edited:
Still nothing. I think the problem is in both
If Range("S" & i).Value = "Action" Then
and inttrow

I've changed it to "I" & i > '" and i got 1 result in line 4.
Works for me?

1667748030088.png


However I did go back to the xlsm workbook as I previously mentioned.?
 
Thank you all once more for your help!!!!!!!!! :)
 
Check that code, as I shortened the loop for test purposes.
I also left in the Debug.Print and gave a dedicated path to the xlsx file for my system. I would not leave the path to chance, as you did. I think you were just lucky there. :)

You need to learn to test your code. Testing would have revealed those issues as it did to me.
 
Check that code, as I shortened the loop for test purposes.
I also left in the Debug.Print and gave a dedicated path to the xlsx file for my system. I would not leave the path to chance, as you did. I think you were just lucky there. :)

You need to learn to test your code. Testing would have revealed those issues as it did to me.
I will correct everything, thanks! Path will be full now on!
I think i wouldn't find the error while testing, because data.xlsm was activated during F8.
 
I will correct everything, thanks! Path will be full now on!
I think i wouldn't find the error while testing, because data.xlsm was activated during F8.
Well, I put a breakpoint at the first line of executable code then walked through line by line. Hence why I changed the loop to a small number.
That showed me by hovering over the variables/ranges their values. The debug.print is another quicker way.
Doing that also shows the path the code takes each time.

See the debugging link in my signature for various ways to debug.
 

Users who are viewing this thread

Back
Top Bottom