Wednesday, 28 August 2013

VBA code that concatenates a letter and variable to create a cell reference

VBA code that concatenates a letter and variable to create a cell reference

I have a piece of code that determines the lowest row with data in it. I
want to write to the cell underneath this row so that I don't overwrite
old data, but I'm having trouble referencing this cell. To clarify, I
already have code that determines, for example, that the 51st row is the
lowest row to contain data. I need to correct my second piece of code
which writes to the cell below that row:
Note: The integer "highest" is the row number lowest on the table that
contains data
sh1.Range(Concatenate(",'B', (highest+1),")).Value
I also tried
sh1.Range("B" & (highest+1)
Finally, I checked several forums and they hinted that I should use
indirect to create a cell reference, but I haven't had much luck with
that. What would the correct way to do this be?

No comments:

Post a Comment