W
WembleyBear
Hi
I have a small user form to allow editing of my spreadsheet, using code I
modified from Contextures website. However, there are occasions when the user
might leave one or two of the fields on the user form blank and on this
occasion I would NOT want the corresponding fields on the spreadsheet to be
cleared.
What changes to the code do I need so that the cell is updated if the field
on the user form contains a value but not updated if that particular field is
left blank?
Private Sub CmdUpdate_Click()
Dim ws As Worksheet
Set ws = Worksheets("Rates")
ws.Cells(3, 2).Value = Me.txtRetFran.Value
ws.Cells(3, 3).Value = Me.txtRetNon.Value
ws.Cells(4, 2).Value = Me.txtWarFran.Value
ws.Cells(4, 3).Value = Me.txtWarNon.Value
ws.Cells(5, 2).Value = Me.txtIntFran.Value
ws.Cells(5, 3).Value = Me.txtIntNon.Value
End Sub
Thanks very much
Martyn
Excel 2000, Windows 2003 server over Citrix PS4
I have a small user form to allow editing of my spreadsheet, using code I
modified from Contextures website. However, there are occasions when the user
might leave one or two of the fields on the user form blank and on this
occasion I would NOT want the corresponding fields on the spreadsheet to be
cleared.
What changes to the code do I need so that the cell is updated if the field
on the user form contains a value but not updated if that particular field is
left blank?
Private Sub CmdUpdate_Click()
Dim ws As Worksheet
Set ws = Worksheets("Rates")
ws.Cells(3, 2).Value = Me.txtRetFran.Value
ws.Cells(3, 3).Value = Me.txtRetNon.Value
ws.Cells(4, 2).Value = Me.txtWarFran.Value
ws.Cells(4, 3).Value = Me.txtWarNon.Value
ws.Cells(5, 2).Value = Me.txtIntFran.Value
ws.Cells(5, 3).Value = Me.txtIntNon.Value
End Sub
Thanks very much
Martyn
Excel 2000, Windows 2003 server over Citrix PS4