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: 4
Default Getting cell address from input box


I have the following code snippets as part of a user input routine. I Dim Userrange as range.
This routine works fine as long as the cell that user selects has a value. If the cell has
as error (it is usually #NA) then the routine does not return the address and goes to
"canceledd". It is possible that the cell might an error code and yet still be acceptable,
usually the error is temporary and goes away on the next re-calc (it is actually an IRR calculation
and sometimes and IRR is impossible to find for a particular set of inputs which occurs about 5%
of the time in this spreadsheet.)

While it is possible "on the error" to re-calc the sheet and try again it is possible that the
condition could occur several times in a row so that is not a very clean solution and hard to explain
to the user why it is necessary to keep trying, particularly when the inputbox shows
the correct address each time.

I also tried to change the "Type:=" to 24 (which is sum of 8 (range) and 16 (error). This results in the
"if xcell" test being true every time no matter the value of the cell.

Can anyone suggest a solution.

Thank you.

Pieter Vandenberg

---------code snippet-----

tryagain:
On Error goto canceledd
Set userrange(loopc) = Application.InputBox _
(Prompt:="Input Cell: Select by clicking on the cell you wish to use", _
Title:="Select Input Cell", _
default:="Select Cell", _
Type:=8)
....

Set Xcell = userrange(loopc)


If Xcell = "" Then
ans = MsgBox("The address you are using appears to be empty. Do you want to continue with the selection?",

vbYesNoCancel + vbQuestion, "Cell Selection")
If ans = vbCancel Then GoTo Canceledd
If ans = vbNo Then GoTo tryagain

....

canceledd:
calculate
goto tryagain
 
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
How to input pictures automatically based on cell input? bsharp Excel Worksheet Functions 9 May 30th 09 07:16 AM
How do I input address data into a table in Excel 2007? Fred New Users to Excel 0 June 19th 07 07:15 PM
ADDRESS function - dynamic input cell claytorm Excel Discussion (Misc queries) 1 June 28th 05 02:05 PM
automate input of an address from Outlook into excel Robb Excel Discussion (Misc queries) 0 June 14th 05 09:21 PM
Pause macro for user cell address input Ed Haslam Excel Programming 2 September 18th 03 07:53 PM


All times are GMT +1. The time now is 11:43 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"