View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default InputBox to select cell locations

Option Explicit
sub testme()
dim Rng as range
dim xStr as string
dim nextCell as range

set rng = nothing
on error resume next
set rng = application.inputbox(Prompt:="Click a cell",type:=8)
on error goto 0

if rng is nothing then
'user hit cancel
exit sub '???
end if

with worksheets("someworksheetnamehere")
set nextcell = .cells(.rows.count,"E").end(xlup).offset(1,0)
end with

rng.copy _
destination:=nextcell

end sub

I wasn't sure what you wanted to do, though. I'm not sure I got it right.

Michael M wrote:

Hi All
I want to use an InputBox to ask the user for a cell location.
Can someone provide me with some code to do this please.
This is what I have so far.
Basically the last line of the example is where it breaks !!

Any input is appreciated
Michael

Dim x As String, z As Range
Application.ScreenUpdating = False
userEntry = InputBox("Enter Preferred Cell Location")
EndRow = Range("E65536").End(xlUp).Row
Set z = Worksheets("Sheet1").Range("userEntry")


--

Dave Peterson