#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
Error of slope taking into account error of the data points cer144 Excel Worksheet Functions 5 July 7th 08 07:26 PM
Counting instances of found text (Excel error? Or user error?) S Davis Excel Worksheet Functions 5 September 12th 06 04:52 PM
Automation Error, Unknown Error. Error value - 440 Neo[_2_] Excel Programming 0 May 29th 04 05:26 AM


All times are GMT +1. The time now is 04:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"