LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Selecting a Range using Inputbox Method

The following procedure works perfectly when the commented line is used
but when I try to use the Inputbox I get an error: "Ojbect required."
It turns out that the list may not start at the same place everytime
and there may be blanks or gaps. I tried to learn about the Inputbox
Method from the sample code at the bottom, which is from a book, but I
can't get it to work either. Any help would be appreciated.

Public Sub RunReports()
Dim vManagers As Range, vManager As Range, DataArray(5)
Windows("DataTable.xls").Activate
'Set vManagers = Range(Cells(23, "D"), Cells(Rows.Count,
"D").End(xlUp))
Set vManagers = Application.InputBox("Use the mouse to select all
manager names in Column D", "Select Range", , , , , , 8)
On Error Resume Next
For Each vManager In vManagers
If vManager.Value = "S. O' Neil" Then
vManager.Activate
DataArray(1) = ActiveCell.Offset(0, -3)
DataArray(2) = ActiveCell.Offset(0, -1)
DataArray(3) = ActiveCell.Offset(0, 1)
DataArray(4) = ActiveCell.Offset(0, 3)
DataArray(5) = ActiveCell.Offset(0, 7)
Windows("Check Deposit Report.xls").Activate
Sheets("CHECK-DEPOSIT").Copy After:=Sheets(1)
ActiveSheet.Unprotect
Range("F43").Value = DataArray(1)
Range("B43").Value = DataArray(2)
Range("F32").Value = DataArray(3)
Range("A43").Value = DataArray(4)
Range("I27").Value = -DataArray(5)
Windows("DataTable.xls").Activate
End If
Next
Windows("Check Deposit Report.xls").Activate
End Sub

Sub GetRange()
Dim UserRange As Range
Default = Selection.Address 'Assignment to constant not permitted.
On Error GoTo Canceled
Set UserRange = Application.InputBox(prompt:="Range to erase:",
Title:="Range Erase", Default:=Default, Type:=8)
UserRange.Clear
UserRange.Select
Canceled:
End Sub

 
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
Detecting Cancel in an InputBox Method Connie Excel Discussion (Misc queries) 2 October 19th 06 01:32 PM
Error 424 with inputbox method after OK Herman[_4_] Excel Programming 1 September 14th 04 11:12 PM
Cancel button in Inputbox method MiRa Excel Programming 2 November 14th 03 01:04 PM
Using Arrays in InputBox Method verizon Excel Programming 4 July 20th 03 08:14 AM
Inputbox method using type:=8 - How to Cancel? Jim Cone Excel Programming 0 July 8th 03 06:15 PM


All times are GMT +1. The time now is 07:12 AM.

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

About Us

"It's about Microsoft Excel"