MyRow error
Can anyone see a problem with this: Code: -------------------- Sheets("Sheet1").Activate Set MySheet = ActiveSheet MyRow = Sheets("Sheet1").Range("O1") Claimno = Range(MyRow, 11) -------------------- It keeps erroring on the last line. I'm trying to get it to find the last value entered on spreadsheet. Range O1 shows the Row to look for and is correctly showing the Row to be used. thanks -- rocket0612 ------------------------------------------------------------------------ rocket0612's Profile: http://www.excelforum.com/member.php...o&userid=19492 View this thread: http://www.excelforum.com/showthread...hreadid=380551 |
MyRow error
Hi Rocket0612,
Try changing: Claimno = Range(MyRow, 11) to Claimno = Cells(MyRow, 11).Value --- Regards, Norman "rocket0612" wrote in message ... Can anyone see a problem with this: Code: -------------------- Sheets("Sheet1").Activate Set MySheet = ActiveSheet MyRow = Sheets("Sheet1").Range("O1") Claimno = Range(MyRow, 11) -------------------- It keeps erroring on the last line. I'm trying to get it to find the last value entered on spreadsheet. Range O1 shows the Row to look for and is correctly showing the Row to be used. thanks -- rocket0612 ------------------------------------------------------------------------ rocket0612's Profile: http://www.excelforum.com/member.php...o&userid=19492 View this thread: http://www.excelforum.com/showthread...hreadid=380551 |
MyRow error
Assuming you're intending to find the last row, column K (the 11th
column): Claimno = Cells(MyRow, 11).Value If not, what do you intend "11" to mean? In article , rocket0612 wrote: Can anyone see a problem with this: Code: -------------------- Sheets("Sheet1").Activate Set MySheet = ActiveSheet MyRow = Sheets("Sheet1").Range("O1") Claimno = Range(MyRow, 11) -------------------- It keeps erroring on the last line. I'm trying to get it to find the last value entered on spreadsheet. Range O1 shows the Row to look for and is correctly showing the Row to be used. thanks |
MyRow error
Using your code:
MyRow = Sheets("Sheet1").Range("O1").Row Claimno = Cells(MyRow, 11) However, the GetLast sub below will find the last occupied row & column of a worksheet. Sheets("Sheet1").Activate Set MySheet = ActiveSheet GetLast Claimno = Cells(lastRow,lastCol) Sub GetLast() lastCol = ActiveSheet.UsedRange.Columns(ActiveSheet.UsedRang e.Columns.Count).Column lastRow = ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.R ows.Count).Row End Sub -- HTH Roger Shaftesbury (UK) "rocket0612" wrote in message ... Can anyone see a problem with this: Code: -------------------- Sheets("Sheet1").Activate Set MySheet = ActiveSheet MyRow = Sheets("Sheet1").Range("O1") Claimno = Range(MyRow, 11) -------------------- It keeps erroring on the last line. I'm trying to get it to find the last value entered on spreadsheet. Range O1 shows the Row to look for and is correctly showing the Row to be used. thanks -- rocket0612 ------------------------------------------------------------------------ rocket0612's Profile: http://www.excelforum.com/member.php...o&userid=19492 View this thread: http://www.excelforum.com/showthread...hreadid=380551 |
All times are GMT +1. The time now is 01:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com