remove any combinations of characters from vba string [closed] - vba

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have a string value of ;00330508911=010403954? in Excel VBA
I would like to remove all characters except for the second set of digits, being 010402600.
I have tried many other alternatives with no luck, any help is appreciated.

Assuming your question is 'how to strip out the number between the equals sign and the question mark', it's basic string manipulation:
Public Function secondNumber(inputStr As String) As String
'text after the equals sign
a = Mid(inputStr, InStr(1, inputStr, "=") + 1, 100)
'and before the question mark
b = Mid(a, 1, InStr(1, a, "?") - 1)
secondNumber = b
End Function

Related

Data extracted from Textbox is not the same as excel data [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I have a Textbox multiline=true
I use formula Split that Textbox but string in textbox can not vlookup value because that is string symbol special.
This is your code,
please check help me.
Sub CommandButton22_Click()
With Sheet2
If Trim(TextBox21.Text) <> "" Then
If UBound(Split(TextBox21.Text, Chr(10))) > 0 Then
For i = 0 To UBound(Split(CStr(TextBox21.Text), Chr(10)))
Dim a As String
a = Trim(CStr(Split(TextBox21.Text, Chr(10))(i)))
If IsEmpty(a) = False Then
.Cells(1 + i, "A").Value = Trim(CStr(a))
End If
Next i
End If
End If
End With
End Sub

How do I concatenate different column value to single cell? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
.
Hello guys,I need your inputs on the topic here.
I intend to combine or concatenate different value in different columns so its shown in a single cell.
Illustration is the following:
1:
Is it possible to do this without macro?
use
=CONCATENATE("The name of the painter: ",A3,CHAR(10), "The Hobby: ", B3, CHAR(10), "Tool used: ", C3,CHAR(10),"Remuneration: ", D3)
To answer your second question on how to do it with code:
Sub PopulateResultsToCell()
Dim X As Long, MyArr As Variant, PrefixArr As Variant
PrefixArr = Array("The name of the painter: ", "The Hobby: ", "Tool used: ", "Remuneration: ")
MyArr = Application.Transpose(Application.Transpose(Range("A3:D3"))) '<-- Change this for the range to read
For X = LBound(MyArr) To UBound(MyArr)
MyArr(X) = PrefixArr(X - 1) & Trim(MyArr(X)) 'Note: Option base is zero but transposing creates a base 1 array hence the X minus 1
Next
Range("F3").Formula = Join(MyArr, vbLf) '<-- Change this for where to populate the result to
End Sub

Search Value from A column and Paste Value of B in Column D [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have a table below with details in column A and B. I want to search a string in C from A and paste value of Column B in Column D with help of VBA.
Example:-
A B C D
STRAT Strategy s_strat_nhnh Strategy
TRDMK Trademarks bng_trdm_ndnd Trademarks
TRDMK not in bng_trdm_ndnd.
But if I got it right, you want something like
Then Code is:
Sub Test()
CStartRow = 1
CEndRow = 5
AStartRow = 1
AEndRow = 3
For I = CStartRow To CEndRow
For J = AStartRow To AEndRow
If InStr(UCase(Range("C" + CStr(I))), UCase(Range("A" + CStr(J)))) Then
Range("D" + CStr(I)) = Range("B" + CStr(J))
Exit For
End If
Next J
Next I
End Sub
If you do not want to use VBA then you can use this formula.
Formula in d1 cell is:
=IF(ISNUMBER(SEARCH(A1,C1)),B1,"")

Hello, can somebody help me or any suggstion code how can I start in conditional for getting the range of specific range number [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
can somebody help me or any suggstion code how can I start in conditional for getting the range of specific range number..
-Example there is textbox 1, 2, 3 and 4...
-I inputed 1 in textbox1 and 5 in textbox2
-in Textbox 3 I will input 3
-In textbox 4 will give the result and it will give me TRUE because 3 is in range of 1-5 but if I input 6 or 0 or any number that is not in the range, it will give me FALSE because it is not in the range of 1-5.
As I understand it, you want to input the range in TextBox1 and TextBox2, the number that needs to be evaluated in TextBox3 and display the result in TextBox4.
Here is the code for that:
If CDbl(TextBox3.Text) > CDbl(TextBox1.Text) And _
CDbl(TextBox3.Text) > CDbl(TextBox2.Text) Then
TextBox4.Text = "TRUE"
Else
TextBox4.Text = "FALSE"
End If

Delete spaces in cell - VBA [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have the following string in excel:
" 163,40 3,10 1,86 163,30 163,40 167,00 163,30 435862329"
And I have no problem to split up this column into 8 individual columns - one for each block of data. But I saw that the first column - here 163.40 is truncated so it becomes 163 - that is from a float to an integer. I realized later thats because the numbers is preceeded by four spaces - " 163.40".
So my question is how to delete these four spaces - and ONLY these four first spaces.
That would solve my problem.
Any ideas?
Use Mid function like used below for your problem.
Mid(text, 5, Len(text))
Assuming that your source string is in cell A1 and you need the 8 columns data in row 2 ; please refer to below code :
Function SplitMyData()
Dim var As Variant
var = Split(Trim(Range("A1").Value), " ", , vbTextCompare)
For i = 0 To UBound(var)
Cells(2, i + 1).Value = var(i) 'Pasting vals in row 2
Next
End Function
You can change the source and destination cell references as per your requirements. :)