Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Visual Basic Error Run Time Error, Type Mismatch | Excel Discussion (Misc queries) | |||
Error of slope taking into account error of the data points | Excel Worksheet Functions | |||
Counting instances of found text (Excel error? Or user error?) | Excel Worksheet Functions | |||
Automation Error, Unknown Error. Error value - 440 | Excel Programming |