LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default entering data into multiple sheets

Me.TbDate.Value = format(Now, "mm/dd/yyyy")

Ranae wrote:

Hi Dave,
I have one more question if you don't mind. With the code below, anywhere I
have a format statement, I get an error. Do you know why that would be?

This will give me a compile error - Wrong number of arguments or invalid
property assignment.

Private Sub Userform_Activate()
Me.TbDate = format(Now, mm / dd / yyyy)

Thanks again for your help

"Dave Peterson" wrote:

I didn't take the time to set up a userform for this...

Option Explicit
Private Sub CommandButton1_Click()
Dim Wbk As Workbook
Dim wks As Worksheet
Dim LastCell As Range 'LastRow sounds like a number to me

Set Wbk = Workbooks("Reworklog")

For Each wks In Wbk.Worksheets(Array("2006-2010", "2010"))
With wks
Set LastCell = .Cells(.Rows.Count, "A").End(xlUp)
End With

With LastCell
.Offset(1, 0).Value = Me.TBRecDate.Value
.Offset(1, 1).Value = Me.TbDate.Value
.Offset(1, 2).Value = Me.TbBoardType.Value
.Offset(1, 3).Value = Me.cboboard.Value
.Offset(1, 5).Value = Me.TbBatch.Value
.Offset(1, 6).Value = Me.TbSN.Value
.Offset(1, 7).Value = Me.cboDefectCode.Value
.Offset(1, 8).Value = Me.cboProdSpec.Value
.Offset(1, 9).Value = Me.cboCM.Value
.Offset(1, 10).Value = Me.cboTech.Value
.Offset(1, 11).Value = Me.TBreject.Value
.Offset(1, 12).Value = Me.TBfinding.Value
.Offset(1, 13).Value = Me.TBAction.Value
.Offset(1, 14).Value = Me.TBLocation.Value
.Offset(1, 15).Value = Me.cboResults.Value
.Offset(1, 16).Value = Me.cboDisposition.Value
.Offset(1, 21).Value = Me.cboPN1.Value
.Offset(1, 22).Value = Me.cboPN2.Value
.Offset(1, 23).Value = Me.cboPN3.Value
.Offset(1, 24).Value = Me.cboPN4.Value
.Offset(1, 20).Value = Me.TbSum.Value

If Me.OptDbug1.Value Then
.Offset(1, 25).Value = Me.OptDbug1.Caption
ElseIf Me.OptDBug2.Value Then
.Offset(1, 25).Value = Me.OptDbug1.Caption
ElseIf Me.OptDbug3.Value Then
.Offset(1, 25).Value = Me.OptDbug1.Caption
End If
End If
End With
Next wks

'Clear fields for next entry
Me.TbSN.Value = ""
Me.cboDefectCode.Value = ""
Me.TBreject.Value = ""
Me.TBfinding.Value = ""
Me.TBAction.Value = ""
Me.TBLocation.Value = ""
Me.OptDbug1.Value = False
Me.OptDBug2.Value = False
Me.OptDbug3.Value = False
Me.cboResults.Value = ""
Me.cboDisposition.Value = ""
Me.cboPN1.Value = ""
Me.cboPN2.Value = ""
Me.cboPN3.Value = ""
Me.cboPN4.Value = ""
Me.Tbcost1.Value = ""
Me.Tbcost2.Value = ""
Me.tbCost3.Value = ""
Me.TbCost4.Value = ""
Me.TbSum.Value = ""
Me.TbSN.SetFocus
End Sub

(Untested, uncompiled.)

Ranae wrote:

Good morning,
I am entering data into a worksheet with a userform. I need to enter the
exact same information into another worksheet (2010). Is there a way to do
this without having to write the same code for the second worksheet? Thank
you in advance.
Ranae

Dim Wbk As Workbook
Set Wbk = Workbooks("Reworklog")
Sheets("2006-2010").Select

Dim LastRow As Object
Set LastRow = Range("a65536").End(xlUp)
LastRow.Offset(1, 0) = Me.TBRecDate
LastRow.Offset(1, 1) = Me.TbDate
LastRow.Offset(1, 2) = Me.TbBoardType
LastRow.Offset(1, 3) = Me.cboboard
LastRow.Offset(1, 5) = Me.TbBatch
LastRow.Offset(1, 6) = Me.TbSN
LastRow.Offset(1, 7) = Me.cboDefectCode
LastRow.Offset(1, 8) = Me.cboProdSpec
LastRow.Offset(1, 9) = Me.cboCM
LastRow.Offset(1, 10) = Me.cboTech
LastRow.Offset(1, 11) = Me.TBreject
LastRow.Offset(1, 12) = Me.TBfinding
LastRow.Offset(1, 13) = Me.TBAction
LastRow.Offset(1, 14) = Me.TBLocation
LastRow.Offset(1, 15) = Me.cboResults
LastRow.Offset(1, 16) = Me.cboDisposition
LastRow.Offset(1, 21) = Me.cboPN1
LastRow.Offset(1, 22) = Me.cboPN2
LastRow.Offset(1, 23) = Me.cboPN3
LastRow.Offset(1, 24) = Me.cboPN4
LastRow.Offset(1, 20) = Me.TbSum

If Me.OptDbug1.Value Then
LastRow.Offset(1, 25) = Me.OptDbug1.Caption
ElseIf Me.OptDBug2.Value Then
LastRow.Offset(1, 25) = Me.OptDbug1.Caption
Else
If Me.OptDbug3.Value Then
LastRow.Offset(1, 25) = Me.OptDbug1.Caption
End If
End If
'Clear fields for next entry
Me.TbSN = ClearContents
Me.cboDefectCode = ClearContents
Me.TBreject = ClearContents
Me.TBfinding = ClearContents
Me.TBAction = ClearContents
Me.TBLocation = ClearContents
Me.OptDbug1 = ClearContents
Me.OptDBug2 = ClearContents
Me.OptDbug3 = ClearContents
Me.cboResults = ClearContents
Me.cboDisposition = ClearContents
Me.cboPN1 = ClearContents
Me.cboPN2 = ClearContents
Me.cboPN3 = ClearContents
Me.cboPN4 = ClearContents
Me.Tbcost1 = ClearContents
Me.Tbcost2 = ClearContents
Me.tbCost3 = ClearContents
Me.TbCost4 = ClearContents
Me.TbSum = ClearContents
Me.TbSN.SetFocus
End Sub


--

Dave Peterson
.


--

Dave Peterson
 
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
Entering multiple data into list Marty Excel Discussion (Misc queries) 1 November 15th 06 03:28 AM
entering same formula in multiple sheets AB Excel Worksheet Functions 1 October 30th 06 08:21 PM
Entering data on differnent sheets in WB STEVEB Excel Programming 1 September 16th 05 09:53 PM
Entering same data into multiple cells Gary H Excel Discussion (Misc queries) 3 April 14th 05 09:55 PM
Entering Data in multiple cells on one sheet & having it auto upda haynblend Excel Worksheet Functions 2 March 27th 05 12:41 AM


All times are GMT +1. The time now is 04:03 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"