Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to get the select property of the Range Class error

Status
Not open for further replies.

mar050703

Technical User
Aug 3, 2007
99
GB
Hi All

I have the following code:
Code:
Private Sub CmdOk_Click()
Dim LastDeal As Integer
          LastDeal = Sheets("Data").Range("A1").End(xlDown).Select
but I keep getting the error "Unable to get the select property of the Range Class."

I am needing to reference the last used cell in RowA as LastDeal, as later in the code I have the following:
Code:
Response = MsgBox("Do you want to print the Deal Sheet?", vbYesNo, "Print")
    Select Case Response
        Case vbYes
        Sheets("Deal Sheet").Select
        Range("E2").Select
        ActiveCell.Value = LastDeal 'Enter the LastDeal Number in cell E2 of the Deal Sheet
        ActiveWindow.SelectedSheets.PrintOut 1, 1, copies:=1
            Case vbNo
                MsgBox "You will need to print out the Deal Sheet for:" & LastDeal, vbExclamation, Warning
    End Select

Thanks in advance

 
If you need to REFERENCE the last cell, then why are you using the SELECT method!
Code:
CODE
Private Sub CmdOk_Click()
Dim LastDeal As Integer
          LastDeal = Sheets("Data").Range("A1").End(xlDown).[b]Value[/b]
 
Skip

I did try that, before, but I did not get the correct answer. However I have discovered the problem. I was working out the last cell with data before I was transferring the new data, and therefore I was returning the data of the previous entry.

I have now changed it back to .value, rather than .select.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top