Increase count by 1 but ignore multiple characters to the left

Watchdawg

Board Regular
Joined
Jan 21, 2015
Messages
84
I've seen a few things around for something similar, but I'm starting to wonder if this is possible...

I formula that finds the last filled cell in range "A". That cell contains the following text "DEV-19-1". I need to increment the last digit (will eventually be 2 digits), but ignore the first 7 characters. I was seeing a lot about using the left/mid/right commands but I don't think that will do what I need it to. Here's the current formula:

HTML:
TextBox1.Value = Sheets("Log").Range("A:A").End(xlDown).Value + 1

Any thoughts or am I going about this all wrong?
*quick update, I will need to retain those first 7 characters in the userform, so the form would return DEV-19-2
 
Last edited:

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Something like this...

Code:
Sub x()
Dim str As String
Dim Increment As Long
With Sheets("Log").Cells(Rows.Count, 1).End(xlDown)
    str = Left(.Value, 7)
    Increment = Replace(.Value, str, "") + 1
End With
TextBox1.Value = str & Increment
    
End Sub
 
Upvote 0
How about
Code:
   Dim St As String
   St = Sheets("Log").Range("A" & Rows.Count).End(xlUp).Value
   Me.TextBox1.Value = Left(St, InStrRev(St, "-")) & Right(St, Len(St) - InStrRev(St, "-")) + 1
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,431
Messages
6,119,457
Members
448,898
Latest member
drewmorgan128

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