Z
Zygoid
not sure what you mean Dave.
this is the code i have. perhaps it is the way it is created and save
as CLng.
I have tried different codes but none work. All the other comboboxes o
the form work fine,
but they all are alphabets. this is the only numeric. and the only on
with a problem.
on the initialize, it creates a new jobnumber in textbox1.
and fills a combobox with jobnumbers created in the past.
the form allows to create a new or open a past job.
Private Sub UserForm_Initialize()
Dim mydate As Date
Dim wb As Workbook
Dim rng As Range
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Set wb = Workbooks.Open("f:\book2.xls")
With wb.Sheets("sheet1")
FName = Range("A65536").End(xlUp).Offset(1, 0).Row
Me.textbox1.Value = Format$(Date, "mmddyy") & FName
Me.textbox1.Value = CLng(Me.textbox1.Value)
End With
With wb.Sheets("sheet1")
Set rng = .Range(.Range("A2"), .Range("A2").End(xlDown))
End With
Me.combobox1.List = rng.Value
wb.Close False
end sub
if a new job or past job is changed. the user clicks the save button
this is how it is saved.
Private Sub cmdSave_Click()
Dim res As Variant
Dim SourceWB As Workbook
Dim SourceRng As Range
Dim DestCell As Range
Set SourceWB = Workbooks.Open("f:\book2.xls")
With SourceWB.Sheets("sheet1")
Set SourceRng = .Range("a2", .Cells(.Rows.Count, "A").End(xlUp))
res = Application.Match(CLng(textbox1.Value), SourceRng, 0)
If IsError(res) Then
Set DestCell = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
Else
Set DestCell = SourceRng(res)
End If
With DestCell
.Offset(0, 0) = textbox1.Value
'alot more offsets but this is the referenced.
end sub
I am not sure if the way the number is saved
this is the code i have. perhaps it is the way it is created and save
as CLng.
I have tried different codes but none work. All the other comboboxes o
the form work fine,
but they all are alphabets. this is the only numeric. and the only on
with a problem.
on the initialize, it creates a new jobnumber in textbox1.
and fills a combobox with jobnumbers created in the past.
the form allows to create a new or open a past job.
Private Sub UserForm_Initialize()
Dim mydate As Date
Dim wb As Workbook
Dim rng As Range
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Set wb = Workbooks.Open("f:\book2.xls")
With wb.Sheets("sheet1")
FName = Range("A65536").End(xlUp).Offset(1, 0).Row
Me.textbox1.Value = Format$(Date, "mmddyy") & FName
Me.textbox1.Value = CLng(Me.textbox1.Value)
End With
With wb.Sheets("sheet1")
Set rng = .Range(.Range("A2"), .Range("A2").End(xlDown))
End With
Me.combobox1.List = rng.Value
wb.Close False
end sub
if a new job or past job is changed. the user clicks the save button
this is how it is saved.
Private Sub cmdSave_Click()
Dim res As Variant
Dim SourceWB As Workbook
Dim SourceRng As Range
Dim DestCell As Range
Set SourceWB = Workbooks.Open("f:\book2.xls")
With SourceWB.Sheets("sheet1")
Set SourceRng = .Range("a2", .Cells(.Rows.Count, "A").End(xlUp))
res = Application.Match(CLng(textbox1.Value), SourceRng, 0)
If IsError(res) Then
Set DestCell = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
Else
Set DestCell = SourceRng(res)
End If
With DestCell
.Offset(0, 0) = textbox1.Value
'alot more offsets but this is the referenced.
end sub
I am not sure if the way the number is saved