WarPigl3t
Well-known Member
- Joined
- May 25, 2014
- Messages
- 1,611
I don't want to find a character in a cell
I type this function into cell D1... =Mjolnir(A1:B1)
I type this function into cell D1... =Mjolnir(A1:B1)
Code:
Function Mjolnir(a As Excel.Range)
aVal = a.Address(0, 0, xlA1, 0)
[COLOR=#008000]'Now aVal equals "A1:B1" as a string of text
'I want to return a variable that contains just the _
row number of the first part of the range in the string text. _
So I need to return the 1 in between the A and the : _
I do this by first locating the : in the string of text.[/COLOR]
[COLOR=#b22222][B] strLength = Application.WorksheetFunction.Find(bVal, ":")[/B][/COLOR]
[COLOR=#008000]'strLength should give me the position of the colon. _
It is located in position 3. This code doesn't work _
because it is not a range, it is a string.
'I need something that can do that with a string, not a range. It needs to be _
dynamic because a user might have selected range AA25:BB25. _
This means I can't simply use left and right functions without knowing _
first how to find the colon.[/COLOR]
End Function
Last edited: