Re: Select the last cell with a value and edit macro
I hope this helps. Without the actual excel sheet it is a little more difficult but the following should help you along
To dynamically find a range you could use code such as this
Code
Dim lastRow As Integer
Dim lastCol As Integer
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
lastCol = Cells(1, Columns.Count).End(xlToLeft).Column
Dim xRange As Range
Set xRange = Range("A1", Cells(lastRow, lastCol))
xRange.Select
This will select the range you wish to copy no matter how many rows there are or how many columns assuming the data starts in cell A1
To past the values and their formats you would use something like this
Code
Sheets("Data").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
If this does not help upload the spreadsheet with some data and it would make things easier as I think in your code you have a lot of commands which you probably don't need. I assume this was from a macro recording?
Hope this helps but if not as I said upload a sample sheet and I will sort it out for you
Anthony