I am new to VBA and currently editing recorded macros so my undestanding is limited. Please be gentle!
I receive a log file everyday where I want to insert a calculation at the end of each row, but I never know how many rows there will be. How can I achieve this without copying it into the whole column - I have tried this using an if statement to put a null string if there is no data, but using a named range or used.range to graph the data then includes all the 0 strings.
I have tried using relative references to go down the last column of data, offset and name the next cell as a range - but this code always specifies the row - is there a way around this:
ActiveWorkbook.Names.Add Name:="lastcell", RefersToR1C1:="=Log!R95C6"
as mentioned the number of rows vaires.
Or is there a way to loop through the cells and add the formula only to those where data exists?
Many thanks
I receive a log file everyday where I want to insert a calculation at the end of each row, but I never know how many rows there will be. How can I achieve this without copying it into the whole column - I have tried this using an if statement to put a null string if there is no data, but using a named range or used.range to graph the data then includes all the 0 strings.
I have tried using relative references to go down the last column of data, offset and name the next cell as a range - but this code always specifies the row - is there a way around this:
ActiveWorkbook.Names.Add Name:="lastcell", RefersToR1C1:="=Log!R95C6"
as mentioned the number of rows vaires.
Or is there a way to loop through the cells and add the formula only to those where data exists?
Many thanks