Withusing of input box data store in given cell
Hi Patrick,
Now i'm facing new problem in user when ever open the excel, it shows error,
please help me on this
The error msg was,
runtime error 2147221005(800401f3)
coding is,
Private Sub Workbook_Open()
Application.ScreenUpdating = False
Sheets("FOR").Select
Range("A1").Select
Load UserForm1
Application.ScreenUpdating = True
UserForm1.Show
End Sub
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Sheets("FOR").Select
Load UserForm1
Application.ScreenUpdating = True
UserForm1.Show
End Sub
"Patrick Molloy" wrote:
using a Userform would be much easier wouldn't it?
just put the 7 textboxes with 7 corresponding labels, and two buttons - one
cancel and one save
code the save button to push the data into the cells...
the code below is for a userform with just two buttons, btnSave and btnClose
The initialisation part of the code adds a number of labels and text boxes
...you can change this quite easily by chanmging the loop count
Option Explicit
Dim TP As Long
Dim index As Long
Public ctrl As Control
Private Sub UserForm_Initialize()
For index = 1 To 7
Add_A_Control
Next
End Sub
Private Sub Add_A_Control()
Set ctrl = Me.Controls.Add("Forms.Label.1")
With ctrl
TP = TP + ctrl.Height
.Top = TP
.Left = 25
.Caption = "A" & index & " value:"
End With
Set ctrl = Me.Controls.Add("Forms.Textbox.1")
With ctrl
.Top = TP
.Left = 75
.Tag = "A" & index
End With
End Sub
Private Sub btnSave_Click()
For Each ctrl In Me.Controls
If ctrl.Tag < "" Then
Range(ctrl.Tag).Value = ctrl.text
End If
Next
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
"deen" wrote in message
...
Hi Friends,
In sheet1 i need to given input data with using of input box,
EG: In sheet1 A1:A7, once open the excel input box have prompt as data
like below,
Data1 enter the value ____________
Data2 enter the value ____________
Data3 enter the value ____________
Data4 enter the value ____________
Once i enter the data click "OK" automatically data store in a1 to a4
based on input and rest of the cell will be blank( a5 to a7)
Thanks & Regards,
Deen
|