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: 29
Default Looking for Help in modifying a code

I got a problem with my vba UserForm, here is the code:
Private Sub CommandButton1_Click()
Dim r As Variant
Dim C As Integer

C = TextBox1.Text

If IsNumeric(C) = False Then
MsgBox "Please enter an integer."

Else
For r = 1 To 700
If Cells(r, C).Value = "0" Then
Rows(r).Hidden = True
End If
Next
End If
End Sub

I'd like to make it when people key in a non-numeric character in the
textbox, it will promt out the message,however, when i Dim C As
Integer, once we key in a non numeric char it will cause a run time
error,since it is not an integer as i declared and if i Dim c As
Variant, the Cells(r,c) will not work as Cells() required an integer
inside.
Can anyone tell me how to solve the problem?
 
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
modifying code in run time alfaista Excel Programming 2 November 18th 04 10:09 PM
Help is needed for modifying this code. J_J Excel Programming 2 October 10th 04 09:59 PM
Need Help Modifying Code JStone0218 Excel Programming 2 January 19th 04 10:27 AM
Help modifying code BruceJ[_2_] Excel Programming 1 December 10th 03 12:52 AM
Modifying Code that deletes a Row Todd Huttenstine[_2_] Excel Programming 2 November 27th 03 10:41 PM


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