Solved VBA loop issue (1 Viewer)

cheekybuddha

AWF VIP
Local time
Today, 21:14
Joined
Jul 21, 2014
Messages
2,280
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
'             ^      ^   
' ...
 

CosmaL

Registered User.
Local time
Today, 23:14
Joined
Jan 14, 2010
Messages
92
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.
 

Gasman

Enthusiastic Amateur
Local time
Today, 21:14
Joined
Sep 21, 2011
Messages
14,310
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:

Gasman

Enthusiastic Amateur
Local time
Today, 21:14
Joined
Sep 21, 2011
Messages
14,310
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.?
 

CosmaL

Registered User.
Local time
Today, 23:14
Joined
Jan 14, 2010
Messages
92
Thank you all once more for your help!!!!!!!!! :)
 

Gasman

Enthusiastic Amateur
Local time
Today, 21:14
Joined
Sep 21, 2011
Messages
14,310
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.
 

CosmaL

Registered User.
Local time
Today, 23:14
Joined
Jan 14, 2010
Messages
92
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.
 

Gasman

Enthusiastic Amateur
Local time
Today, 21:14
Joined
Sep 21, 2011
Messages
14,310
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

Top Bottom