Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using input box to improve my method


Hi, about a month ago (with some help) i came up with the following
method for saving required filepaths to my worksheet. This project has
since grown and i now have many filepaths required. For this reason i
would like to change the below section in red to incorporate a input
box that allows user to select a cell to update, meaning i can use same
code only once.

I thought i could use

dim rng as range
set rng = Application.InputBox("Click Cell You wish to change")

Unfortunately it seems that the rng is not being set when the user
clicks ok on inputbox. WHere am i going wrong? Thanks

--Original code----
Dim pathChange As Range
Dim pathandfilename As Variant

Public Sub NQAJ_change()
Range("C15").Select
Set pathChange = ActiveCellGetPath
End Sub

Sub GetPath()
pathandfilename = Application.GetOpenFilename

If pathandfilename = False Then
MsgBox "User quits the dialog"
Else
' MsgBox "The path is: " & pathandfilename
pathChange = pathandfilename
End If

End Sub


--
cereldine
------------------------------------------------------------------------
cereldine's Profile: http://www.excelforum.com/member.php...o&userid=32069
View this thread: http://www.excelforum.com/showthread...hreadid=545428

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default Using input box to improve my method

Set rng = Application.InputBox("Click Cell You wish to change", Type:=8)

--
HTH

Bob Phillips

(replace xxxx in email address with googlemail if mailing direct)

"cereldine" wrote
in message ...

Hi, about a month ago (with some help) i came up with the following
method for saving required filepaths to my worksheet. This project has
since grown and i now have many filepaths required. For this reason i
would like to change the below section in red to incorporate a input
box that allows user to select a cell to update, meaning i can use same
code only once.

I thought i could use

dim rng as range
set rng = Application.InputBox("Click Cell You wish to change")

Unfortunately it seems that the rng is not being set when the user
clicks ok on inputbox. WHere am i going wrong? Thanks

--Original code----
Dim pathChange As Range
Dim pathandfilename As Variant

Public Sub NQAJ_change()
Range("C15").Select
Set pathChange = ActiveCellGetPath
End Sub

Sub GetPath()
pathandfilename = Application.GetOpenFilename

If pathandfilename = False Then
MsgBox "User quits the dialog"
Else
' MsgBox "The path is: " & pathandfilename
pathChange = pathandfilename
End If

End Sub


--
cereldine
------------------------------------------------------------------------
cereldine's Profile:

http://www.excelforum.com/member.php...o&userid=32069
View this thread: http://www.excelforum.com/showthread...hreadid=545428



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Using input box to improve my method

Hi Cereldine,

You should also check if user selected valid range or didn't hit cancel
button:

Dim rng As Range
On Error Resume Next
Set rng = Application.InputBox("Click Cell You wish to change",
Type:=8)
If Err < 0 Then
MsgBox "Not valid range or cancel"
End If

Regards,
Ivan

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
An alternate input method? TheMilkGuy Excel Discussion (Misc queries) 6 November 26th 08 07:12 AM
Numerical Input via an inputbox method Tom Ogilvy Excel Programming 0 August 16th 04 07:33 PM
Numerical Input via an inputbox method Bob Phillips[_6_] Excel Programming 0 August 16th 04 07:30 PM
Find method using User input Cory Thomas[_4_] Excel Programming 1 June 8th 04 10:12 PM
How can I improve the find method? Simon Livings Excel Programming 10 May 10th 04 12:05 PM


All times are GMT +1. The time now is 05:37 PM.

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"