Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Activate button when all fields populate


Hi everyone,

I have a button that I would like to have disabled until cells B2:B6 is
populated. Can someone help with that code? Below is my original code
as it stands right now.

The other thing is that cell B5 is a drop down box done by data
validation, not a control box. The drop down has 3 selections. If you
pick 2 of the selections, B6 should probably be populated by 5 digits.
If you pick the other selection, "NEW", B6 will be populated by 5
digits followed by a letter, like 12345A. Is it possible to have a
msgbox pop up if they select "NEW" in B5 and then type a number like
12345 with no letter, and have it say something like, "you need a
letter". If that can be done, I'd appreciate that as well.

Utlimately, any help is appreciated as I have no idea what I'm doing
right now.



Code:
--------------------
Private Sub CommandButton1_Click()
Dim NextRow As Long
Application.ScreenUpdating = False
Me.CommandButton1.Enabled = False
With Worksheets("Admin")
NextRow = .Range("A" & Rows.Count).End(xlUp).Row + 1
Me.Range("B2:B6").Copy
.Range("A" & NextRow).PasteSpecial Transpose:=True
End With
Me.Range("B2:B6").ClearContents
Me.CommandButton1.Enabled = True
Application.ScreenUpdating = True
Run "Macro2"

End Sub
--------------------


--
surplusbc
------------------------------------------------------------------------
surplusbc's Profile: http://www.excelforum.com/member.php...fo&userid=5377
View this thread: http://www.excelforum.com/showthread...hreadid=507352

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Activate button when all fields populate

Here's the part for enabling/disabling the command button

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim Cell As Range

For Each Cell In Range("B2:B6")
If Cell.Value = "" Then
CommandButton1.Enabled = False
Exit Sub
End If
Next Cell

CommandButton1.Enabled = True

End Sub


"surplusbc" wrote:


Hi everyone,

I have a button that I would like to have disabled until cells B2:B6 is
populated. Can someone help with that code? Below is my original code
as it stands right now.

The other thing is that cell B5 is a drop down box done by data
validation, not a control box. The drop down has 3 selections. If you
pick 2 of the selections, B6 should probably be populated by 5 digits.
If you pick the other selection, "NEW", B6 will be populated by 5
digits followed by a letter, like 12345A. Is it possible to have a
msgbox pop up if they select "NEW" in B5 and then type a number like
12345 with no letter, and have it say something like, "you need a
letter". If that can be done, I'd appreciate that as well.

Utlimately, any help is appreciated as I have no idea what I'm doing
right now.



Code:
--------------------
Private Sub CommandButton1_Click()
Dim NextRow As Long
Application.ScreenUpdating = False
Me.CommandButton1.Enabled = False
With Worksheets("Admin")
NextRow = .Range("A" & Rows.Count).End(xlUp).Row + 1
Me.Range("B2:B6").Copy
.Range("A" & NextRow).PasteSpecial Transpose:=True
End With
Me.Range("B2:B6").ClearContents
Me.CommandButton1.Enabled = True
Application.ScreenUpdating = True
Run "Macro2"

End Sub
--------------------


--
surplusbc
------------------------------------------------------------------------
surplusbc's Profile: http://www.excelforum.com/member.php...fo&userid=5377
View this thread: http://www.excelforum.com/showthread...hreadid=507352


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
Auto populate fields Dianne Excel Discussion (Misc queries) 1 September 4th 08 01:36 PM
Populate Fields soccerhead Excel Discussion (Misc queries) 1 January 11th 08 10:27 PM
Automatically Populate Fields tqdinh22 Excel Discussion (Misc queries) 1 July 17th 06 09:22 PM
Auto populate other fields? sedonovan Excel Discussion (Misc queries) 3 June 21st 06 05:34 PM
populate fields with macro Crystal Excel Discussion (Misc queries) 0 June 22nd 05 04:28 PM


All times are GMT +1. The time now is 09:05 AM.

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"