Code stops at blank cell

nice

New Member
Joined
Oct 10, 2022
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hi I am try to run some code and it keeps stoppng at an empty cell I have checked the cell is empty it is I have tried some of the solution on other post and I'm obviously doing something wrong but I don't know what it is basically reading football reults and taking the home goals as one figure in next column but where a game was postponed i have a blank cell and code stops any help with be very much appreciated
ScreenShot020.jpg



VBA Code:
For i = 2 To finalrow
    
    lg = Left(ActiveCell.Offset(0, -1), 2)
    Cells(i, 8) = lg
    Range("h30").End(xlUp).Offset(1, 0).Select
    

  If i = 30 Then Exit For

Next i
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Welcome to the Board!

I think your issue could be with how your "finalrow" value is being calculated, but you have not posted that part of your code.
Could you post that?
 
Upvote 0
My final is calculated from another sheet with 381 lines
 
Upvote 0
It is very difficult to debug without seeing which columns your data resides in on your sheet (you included the header row, but not the part of the screen print which shows us exactly where you data is located (and your code refers to column "H").

Which of those data columns is column H?
 
Upvote 0
can i send the whole workbook is that possible
 
Upvote 0
You cannot attach files to your posts on this site.

However, MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

If you could just include your row and column headers, so I can see exactly where everything is on your worksheet, then it would make more sense what your code is doing.
 
Upvote 0
My sheet takes results from an external source adds them to a sheet then my code goes through all the data and places all the data onto named sheets of the teams breaks down all the scores and adds them to a league table I dont know how would post all that for you to see in bits
 
Upvote 0
Up in your very first post, you posted a screen print.
Just post one that includes the Column Letters and Row Numbers for me to see!

1665424870875.png


It is hard to know what your code is doing in relation to your data when I cannot tell which columns/rows of data it is referencing!
All I need is a picture of your data (like in one run), that shows these column letters and data row numbers along with your data.
 
Upvote 0

Forum statistics

Threads
1,214,982
Messages
6,122,581
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top