ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Entering data from a userform into multiple sheets (https://www.excelbanter.com/excel-programming/440196-entering-data-userform-into-multiple-sheets.html)

Edu[_2_]

Entering data from a userform into multiple sheets
 
I have created a userform. And depending on the value of a particular drop
down menu, the data will be entered into multiple sheets. I have used an if
statement to attempt this, but i get an error when i run it. (run-time error
'438': Object doesn't support this property or method)

Please assist me with this, i am brand new to programming. Thanks in
Advance.

My code:


Private Sub savdata_Click()
' set form to workbook

ActiveWorkbook.Sheets("Feb2010").Activate
Range("A1").Select

'find and empty cell

Do

If IsEmpty(ActiveCell) = False Then

ActiveCell.Offset(1, 0).Select

End If

Loop Until IsEmpty(ActiveCell) = True

' enter data from form to wooksheet

ActiveCell.Value = dateText.Value

ActiveCell.Offset(0, 1) = ComboBox1.Value

ActiveCell.Offset(0, 2) = CmbPerson.Value

ActiveCell.Offset(0, 3) = CmbAcct.Value

ActiveCell.Offset(0, 4) = itemNum.Value

ActiveCell.Offset(0, 5) = debBox.Value

ActiveCell.Offset(0, 6) = credBox.Value

ActiveCell.Offset(0, 7) = desBox.Value

' add data to Purchased Phones Sheet _
if Transaction drop down menu equals purchased phone
If ComboBox1.Value = "Purchased Item" Then

Sheets("Purchased Phones").Active
Range("A1").Select
Do

If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If

Loop Until IsEmpty(ActiveCell) = True

' enter data from form

ActiveCell.Offset(0, 1) = Date
End If




'clear the data in form
dateText.Value = Date
CmbPerson.Value = ""
CmbAcct.Value = ""
itemNum.Value = ""
debBox.Value = ""
credBox.Value = ""
desBox.Value = ""





End Sub

JLGWhiz[_2_]

Entering data from a userform into multiple sheets
 

Sheets("Purchased Phones").Active

Could be the above line of code is the problem. Try Activate instead of
Active.




"Edu" wrote in message
...
I have created a userform. And depending on the value of a particular drop
down menu, the data will be entered into multiple sheets. I have used an
if
statement to attempt this, but i get an error when i run it. (run-time
error
'438': Object doesn't support this property or method)

Please assist me with this, i am brand new to programming. Thanks in
Advance.

My code:


Private Sub savdata_Click()
' set form to workbook

ActiveWorkbook.Sheets("Feb2010").Activate
Range("A1").Select

'find and empty cell

Do

If IsEmpty(ActiveCell) = False Then

ActiveCell.Offset(1, 0).Select

End If

Loop Until IsEmpty(ActiveCell) = True

' enter data from form to wooksheet

ActiveCell.Value = dateText.Value

ActiveCell.Offset(0, 1) = ComboBox1.Value

ActiveCell.Offset(0, 2) = CmbPerson.Value

ActiveCell.Offset(0, 3) = CmbAcct.Value

ActiveCell.Offset(0, 4) = itemNum.Value

ActiveCell.Offset(0, 5) = debBox.Value

ActiveCell.Offset(0, 6) = credBox.Value

ActiveCell.Offset(0, 7) = desBox.Value

' add data to Purchased Phones Sheet _
if Transaction drop down menu equals purchased phone
If ComboBox1.Value = "Purchased Item" Then

Sheets("Purchased Phones").Active
Range("A1").Select
Do

If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If

Loop Until IsEmpty(ActiveCell) = True

' enter data from form

ActiveCell.Offset(0, 1) = Date
End If




'clear the data in form
dateText.Value = Date
CmbPerson.Value = ""
CmbAcct.Value = ""
itemNum.Value = ""
debBox.Value = ""
credBox.Value = ""
desBox.Value = ""





End Sub




Edu[_2_]

Entering data from a userform into multiple sheets
 
Thank you so much for your keen eye, and your quick reply!

"JLGWhiz" wrote:


Sheets("Purchased Phones").Active

Could be the above line of code is the problem. Try Activate instead of
Active.




"Edu" wrote in message
...
I have created a userform. And depending on the value of a particular drop
down menu, the data will be entered into multiple sheets. I have used an
if
statement to attempt this, but i get an error when i run it. (run-time
error
'438': Object doesn't support this property or method)

Please assist me with this, i am brand new to programming. Thanks in
Advance.

My code:


Private Sub savdata_Click()
' set form to workbook

ActiveWorkbook.Sheets("Feb2010").Activate
Range("A1").Select

'find and empty cell

Do

If IsEmpty(ActiveCell) = False Then

ActiveCell.Offset(1, 0).Select

End If

Loop Until IsEmpty(ActiveCell) = True

' enter data from form to wooksheet

ActiveCell.Value = dateText.Value

ActiveCell.Offset(0, 1) = ComboBox1.Value

ActiveCell.Offset(0, 2) = CmbPerson.Value

ActiveCell.Offset(0, 3) = CmbAcct.Value

ActiveCell.Offset(0, 4) = itemNum.Value

ActiveCell.Offset(0, 5) = debBox.Value

ActiveCell.Offset(0, 6) = credBox.Value

ActiveCell.Offset(0, 7) = desBox.Value

' add data to Purchased Phones Sheet _
if Transaction drop down menu equals purchased phone
If ComboBox1.Value = "Purchased Item" Then

Sheets("Purchased Phones").Active
Range("A1").Select
Do

If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If

Loop Until IsEmpty(ActiveCell) = True

' enter data from form

ActiveCell.Offset(0, 1) = Date
End If




'clear the data in form
dateText.Value = Date
CmbPerson.Value = ""
CmbAcct.Value = ""
itemNum.Value = ""
debBox.Value = ""
credBox.Value = ""
desBox.Value = ""





End Sub



.



All times are GMT +1. The time now is 08:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com