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: 48
Default Cancel (Dismiss) Input Box

Hello all,
The code below works fine except for, if user wants to cancel before
all of the seleciton has been checked. With this code I do not have a
way for the user to back out or cancel out of the Input Box process.
Any assistance is greatly appreciated. Thank you, Ron


Sub ValidateDataN()

'validate values in a column
Range("e12").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Offset(0, 9).Select
Set Rng = Selection
FirstRow = Rng.Row
LastRow = Rng.Rows(Rng.Rows.Count).Row
col = "n"
'loop thru col n of database, but skip first row with headings
For i = FirstRow To LastRow
FixColumnN
Next i

End Sub

Private Sub FixColumnN()
Dim x As Integer, OK As Boolean
OK = True
'check to ensure six digits entered
If Len(Range("a1")(i, col).Value) < 6 Then
OK = False
End If

If OK = False Then
'Enter a new value in Column B
Range("a1")(i, col).Select
Range("a1")(i, col) = InputBox("Enter a 6 digit value")

'Range("a1")(i, col).Value = vbNullString
123 FixColumnN
End If

Rng.NumberFormat = "@"

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
No cancel on input Luis A. Vázquez Excel Programming 3 September 18th 07 06:12 PM
Input Box Vs Cancel Ardy Excel Programming 6 September 6th 07 07:44 AM
Input Box - CANCEL Danny Excel Worksheet Functions 6 December 1st 06 02:15 AM
Input box to cancel sub when Cancel is clicked. PCLIVE Excel Programming 5 September 5th 06 03:19 PM
cancel input ME @ Home Excel Discussion (Misc queries) 1 February 22nd 06 09:49 AM


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