Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default Need help on checkbox and textbox on userform

1. i got 4 checkbox in a frame. when a user click commandbutton1 i need it
to check if checkbox1.value = true then print sheet1 if checkbox2.value =
true then print sheet2 etc through to checkbox4

2. when user click commandbutton2 i need it to check if textbox1.value =
"user2". if it does i need sheet6 unprotected. (is protected with password
"user1"). the value of textbox2 must be placed in cell (F33). sheet6
protected with password "user1".

thanx guys


Phillip

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Need help on checkbox and textbox on userform

Hi Philip

The code below is one way of doing it

Option Explicit
Dim i As Integer
Dim Ctrl As Control
Private Sub CommandButton1_Click()

For i = 1 To 4

Set Ctrl = UserForm1.Controls("CheckBox" & i)

If Ctrl.Value = True Then

Sheets(i).Activate

ActiveWindow.SelectedSheets.PrintOut _
Copies:=1, Collate:=True

End If

Set Ctrl = Nothing

Next i

End Sub

Private Sub CommandButton2_Click()

If TextBox1.Value = "user2" Then

With Sheets(6)

.Unprotect ("user1")
.Cells(33, 6).Value = TextBox2.Value
.Protect ("user1")

End With

End If

End Sub

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
checkbox and textbox help needed pswanie Excel Programming 0 July 17th 08 08:26 AM
Action Event, CheckBox, Add Row and Textbox Ryan Excel Discussion (Misc queries) 2 July 17th 07 02:32 PM
link a checkbox in a sheet to a checkbox on a userform? Arjan Excel Programming 0 November 10th 06 01:37 PM
Excel VBA - Userform Checkbox/Textbox Problem Thunder5 Excel Programming 1 February 16th 04 02:06 PM
UserForm TextBox to ActiveSheet TextBox over 256 characters Dan E[_2_] Excel Programming 1 July 28th 03 07:36 PM


All times are GMT +1. The time now is 03:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"