Help with this please -

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?:

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.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
After reading my post, I'm not so clear.... I have line cells that have a vertical border running down them.. I just need to copy that to the next newly added info
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top