View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default 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