Incrementing ContractID column +1 upon displaying Userform

Yoshi1989

New Member
Joined
Aug 2, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone,

I've been searching many forums trying to find results, but as I am new to this I'm not sure if I have possibly been entering the coding into the wrong part of the UserForm.

Attached is my actual UserForm and spreadsheet.

What I'm trying to achieve is each time an EndUser opens this form to add new contracts, the UserForm will open and display the most recent reference in Column "A" + 1.

Eg; Currently showing only 1 entry, so the next time UserForm is opened needs to display as 2 in the Contract Number text box on the form.
 

Attachments

  • snp.png
    snp.png
    91.4 KB · Views: 11

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
I did a quick and dirty userform and textbox and put the following in the Userform1 Initialize event

VBA Code:
Private Sub UserForm_Initialize()
    Dim ws As Worksheet
    
    Set ws = ThisWorkbook.ActiveSheet
    TextBox1.Value = ws.Range("A" & ws.Cells(ws.Rows.Count, 1).End(xlUp).Row).Value + 1
 
End Sub

If you process the data and ultimately fill in the Contract ID to the next blank row, you will need to increment the value of the textbox with similar code as above.

1629002615354.png
 
Upvote 0

Forum statistics

Threads
1,214,793
Messages
6,121,617
Members
449,039
Latest member
Mbone Mathonsi

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