I need to be able to open a new worksheet in the same workbook through vba/excel that will copy the previous days workbook and blank out / clear contents on the worskheet so the player has a new sheet to work with. This only happens at the end of the month. So that there is a new sheet for Feb-2008 etc etc .. through dec-2008. I have one workbook with two worksheets, one is were the data base resides (currently called jobs held) the other worksheet just allows the user access to the userform to input the data. Please can anybody help.
This is what I have so far for this one.
Option Explicit
Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets(“JOBS HELD”)
‘find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
‘check for a hold date
If Trim(Me.txtHdate.Value) = “” Then
Me.txtHdate.SetFocus
MsgBox “Please enter todays date”
Exit Sub
End If
‘copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtHdate.Value
ws.Cells(iRow, 2).Value = Me.txtJobnames.Value
ws.Cells(iRow, 3).Value = Me.txtSdnumber.Value
ws.Cells(iRow, 4).Value = Me.txtUhold.Value
ws.Cells(iRow, 4).Value = Me.txtINstructions.Value
ws.Cells(iRow, 4).Value = Me.txtINitials.Value
ws.Cells(iRow, 4).Value = Me.txtRSchedule.Value
ws.Cells(iRow, 4).Value = Me.txtCOmment.Value
‘clear the data
Me.txtHdate.Value = “”
Me.txtJobnames.Value = “”
Me.txtSdnumber.Value = “”
Me.txtUhold.Value = “”
Me.txtINstructions.Value = “”
Me.txtINitials.Value = “”
Me.txtRSchedule.Value = “”
Me.txtCOmment.Value = “”
Me.txtHdate.SetFocus
MsgBox “GOOD JOB, PLEASE EXIT!!”
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, _
CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox “Please use the button!”
End If
End Sub
Thank you, Also I was trying to figure out how to get color palette # 35 permanently in cells c3:c200 and g3:g200 is there a way to combine more than one column like that?