Hi Guys,
I'm trying to do a concatenate on some data that would base on how many data present on column A (header not included) and column B1-F1 (header not included), I tried recording a macro but unfortunately even though column A is only counts until A16(not fix number and may changes depends on data needed), I needed the cells starting from B2(fix)-F1000(can be change) and then remove the formula after (paste Value only).
The issue is since range was set to B2:F1000, the concatenate did not stop on the last data on column A (A16) and continued until it reach cell 1000.
I wanted a code that if concatenate reach the last data on column A (A16-can be change) will automatically stop there instead.
Sample here: I don't want the cells on yellow
Here is the code I got after recording macro, I changed the range until F1000 since data needed may changes on column A
Sub Concat()
ActiveCell.FormulaR1C1 = "=CONCATENATE(RC1,""-"",R1C)"
Range("B2").Select
Selection.Copy
Range("B2:F1000").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Copy
Range("B2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
I hope someone can help modify this code or if anyone who has a better code instead, this should be the formula use: =CONCATENATE($A2,"-",B$1)
Thank you in advance
I'm trying to do a concatenate on some data that would base on how many data present on column A (header not included) and column B1-F1 (header not included), I tried recording a macro but unfortunately even though column A is only counts until A16(not fix number and may changes depends on data needed), I needed the cells starting from B2(fix)-F1000(can be change) and then remove the formula after (paste Value only).
The issue is since range was set to B2:F1000, the concatenate did not stop on the last data on column A (A16) and continued until it reach cell 1000.
I wanted a code that if concatenate reach the last data on column A (A16-can be change) will automatically stop there instead.
Sample here: I don't want the cells on yellow
Here is the code I got after recording macro, I changed the range until F1000 since data needed may changes on column A
Sub Concat()
ActiveCell.FormulaR1C1 = "=CONCATENATE(RC1,""-"",R1C)"
Range("B2").Select
Selection.Copy
Range("B2:F1000").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Copy
Range("B2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
I hope someone can help modify this code or if anyone who has a better code instead, this should be the formula use: =CONCATENATE($A2,"-",B$1)
Thank you in advance