MFish
Board Regular
- Joined
- May 9, 2019
- Messages
- 76
Hi,
I have a sheet that has a Userform that has textboxes/comboboxes/etc that will be my data input. I have a header for my "table" and they're simple lines that run Vertical. Once I input the information in the userform and hit submit, it already cycles to the next available line to add but it doesn't have the capability to recognize the cell above to "copy" the format within this newly added input.
Code I have so far... More above and below, but this is the part I would assume it would go to copy the format above?:
sorttable has a module written to sort the unique ID... Code goes:
Last but not least... So far my table is only from B7:P7 and downward. It will eventually get longer towards the "X7"... But that's in the future. Thanks for the help.
I have a sheet that has a Userform that has textboxes/comboboxes/etc that will be my data input. I have a header for my "table" and they're simple lines that run Vertical. Once I input the information in the userform and hit submit, it already cycles to the next available line to add but it doesn't have the capability to recognize the cell above to "copy" the format within this newly added input.
Code I have so far... More above and below, but this is the part I would assume it would go to copy the format above?:
Code:
Range("B7").Select
'Check for duplicate bill name[INDENT]Do Until UCase(ActiveCell) = UCase(cmbLH) Or ActiveCell = ""[/INDENT]
[INDENT]ActiveCell.Offset(1, 0).Select
[/INDENT]
Loop
If ActiveCell <> "" Then[INDENT]MsgBox "" & cmbLH & " already exists in the Table. Please choose a different Line Haul Number", _[/INDENT]
[INDENT]vbOKOnly, "Duplicate Line Haul Number detected"
[/INDENT]
frmAdd.Show
Exit Sub
Else: End If
' Cannot override the duplicate line haul number
'forces the user to choose a different line haul number
''stop
''add in the sheet provided below
ActiveCell.Value = cmbLH
ActiveCell.Offset(0, 1).Value = txtDate
ActiveCell.Offset(0, 2).Value = cmbOrig
ActiveCell.Offset(0, 3).Value = cmbDest
ActiveCell.Offset(0, 5).Value = frm53.txtTotalVol
ActiveCell.Offset(0, 6).Value = txtSeal
ActiveCell.Offset(0, 7).Value = txtName
ActiveCell.Offset(0, 9).Value = txtTruck
ActiveCell.Offset(0, 10).Value = txtTrailer
ActiveCell.Offset(0, 11).Value = cmbTPCName
ActiveCell.Offset(0, 12).Value = txtDrivStart
ActiveCell.Offset(0, 13).Value = txtLoad
ActiveCell.Offset(0, 14).Value = txtDep[INDENT]If ob53.Value = True Then
ActiveCell.Offset(0, 8).Value = "53"
[/INDENT]
Else: End If[INDENT]If ob28.Value = True Then
ActiveCell.Offset(0, 8).Value = "28"[/INDENT]
Else: End If[INDENT]If ob26.Value = True Then
ActiveCell.Offset(0, 8).Value = "26"
[/INDENT]
Else: End If
Unload Me
sorttable
sorttable has a module written to sort the unique ID... Code goes:
Code:
Sub sorttable()
Dim LHTable As Range
Range("B7").Select
Set LHTable = Range(ActiveCell, ActiveCell.End(xlDown).Offset(0, 100))
LHTable.Select
Worksheets("Input new run").Range(Selection, Selection).Sort _
key1:=Worksheets("Input new run").Range(ActiveCell, ActiveCell)
End Sub
Last but not least... So far my table is only from B7:P7 and downward. It will eventually get longer towards the "X7"... But that's in the future. Thanks for the help.