(EDITED, SEE BELOW FOR PREVIOUS MESSAGE) Based on the linked posts and suggestion comments, I changed my code to include this line (I've tried with x1Up and x1Down)
Dim row As Integer
row = Worksheets("Quickbooks").Range("H2").End(x1Down).row
Worksheets("Quickbooks").Range(Worksheets("Quickbooks").Cells(2, "J"), Worksheets("Quickbooks").Cells(row, "J")).Value = 1
I'm getting an "Application-defined or object-defined error" now, and I'm not sure what is causing it. Do you have any ideas?
------PREVIOUS POST------------------------------------------------------------------------------------ I'm new to VBA and having a hard time with implementing the last cell/row/column functions in code. In this line of code I'm trying to delineate a range with one of these functions. I want the range to go from cell J2 to cell Jend. J is filled with just the value "1" and Jend is determined by column H. When column H has no more values, J should stop too. I get errors when I try this and other variations of it. How would you recommend fixing it/writing it? And, maybe more generally, any tips or rules of thumb for using these last cell functions in range declarations? Thank you!
Worksheets("Quickbooks").Range(Cells(2, "J"), Cells(Rows.Count, "H").End(xlUp).Select) = 1