Pending query

PANKAJUTEKAR

Board Regular
Joined
Jun 10, 2011
Messages
79
Good Morning All,

Yestreday i had asked the query about concatenate.

I coded was
Function concatenate()
Dim i As Integer, j As Integer, k As Integer
'Cells(i, k) = Cells(2, 1)
j = 2
Do Until j = 18
ActiveCell = "P-" & Cells(2, j)
j = j + 1
'k = k + 1
ActiveCell = ActiveCell.Offset(1, 0)
Loop
End Function

Private Sub Workbook_Open()
Call concatenate
End Sub

this code i got from one of the Experts as solution.
Function concatenate()
Dim j As Integer
j = 1
Do Until j = 18
ActiveCell = "P-" & Cells(2, j)
j = j + 1
ActiveCell = ActiveCell.Offset(1, 0)
Loop
End Function

the value started from cell b2.
P-with tag required in a2.

col b is increament with every new value.
but the concatenate place done only in same cell i.e- a2 only.
my col a does not increament.

So can anyone give me correct modification?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Listen, can you explain thoroughly what do you want in step-by-step way?
 
Upvote 0
Listen, can you explain thoroughly what do you want in step-by-step way?
===========================

COL B contains some tags.
b2 = 155-t-151
b3 = 150-t-253
b4 = 155-m-253
and till 20 or sometimes 50 and any no.

What i trying to did -
a2 = P-155-t-151
a3 = P-150-t-253
a4 = P-155-m-253
till the tag area in col b.

we can use "Concatenate function" for this in excel.

In coding, for single cell or 10 to 15 cells, we can apply this -
Range("A2").Formula = "=Concatenate(""P-""," & Cells(2, 2).Address & ")"

But for no. of cells say suppose, 50 or 100 or 500, i was tryed but that not done.
Then as per the kind solution u had given me that i applied, but that applied for one cell only i.e- a2.
a2 is not coming to next cell i.e- a3 , a4 , a5 and so on till the value present in col b.

Therefore, i asked the same, off course, my code has wrong...
I used the correct solution but that is also working.....
but one problem left that was col a was not increamented.

For this, i asked the solution?
Need your kind solution..Experts.
 
Upvote 0
Try this.
Code:
[COLOR="Blue"]Sub[/COLOR] Concatenate()

    [COLOR="Blue"]Dim[/COLOR] i [COLOR="Blue"]As[/COLOR] [COLOR="Blue"]Long[/COLOR]

    Application.ScreenUpdating = [COLOR="Blue"]False[/COLOR]
        
    [COLOR="Blue"]For[/COLOR] i = 2 [COLOR="Blue"]To[/COLOR] Range("B2").End(xlDown).Row
        Cells(i, "A") = "P-" & Cells(i, "B")
    [COLOR="Blue"]Next[/COLOR]
    
[COLOR="Blue"]End[/COLOR] [COLOR="Blue"]Sub[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,678
Members
452,937
Latest member
Bhg1984

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