Hi
Thanks for taking the time to look at this and any help you give.
I am trying to take a name range TRange = ("A2:D") and resize it to include the last row of the sheet, I have the code for last row which passes to a variant called lastrow for the sheet I am doing this on ,the last row would be 92 but this is a function I want to run on various sheets with different size last rows so need to change the range depending on the sheet A2:D will always be the starting range to be passed to this function.
I have tried a few ways of doing this but unable to get it right this is the way im trying it at present but I don't seem to be able to get it quite right.
application defined or object defined error
Thanks for taking the time to look at this and any help you give.
I am trying to take a name range TRange = ("A2:D") and resize it to include the last row of the sheet, I have the code for last row which passes to a variant called lastrow for the sheet I am doing this on ,the last row would be 92 but this is a function I want to run on various sheets with different size last rows so need to change the range depending on the sheet A2:D will always be the starting range to be passed to this function.
I have tried a few ways of doing this but unable to get it right this is the way im trying it at present but I don't seem to be able to get it quite right.
application defined or object defined error
Code:
Range(TRange.Name).Resize(lastrow, Range(TRange.Name).Columns.Count).Resize.Name = TRange.Name[/FONT][/COLOR][COLOR=#222222][FONT=Verdana]