#1
|
|||
|
|||
Concatenate Macro VBA
Hi all,
I need help with a macro. In cell A1, I have the following number: 025 I have 15 different SHEETS with different numbers in cell A1. In cell B10 (in all 15 sheets), I have the following information: 43610 General Advertising-Full Run In cell A10, I have the following formula: ="NF-"&A$1&"-"&LEFT(B10,5)&"-"&MID(B10,7,45)&"--Budget 2019" The result in cell A10, is the following: NF-025-43610- General Advertising-Full Run--Budget 2019 So, the formula is working fine. My goal is for the macro to be able to run the formula in cell A10 to 15 different sheets without having to do copy and paste. Hope I can get some help. Thank you in advance for your assistance and cooperation. Cheers! |
#2
|
||||
|
||||
You don't really need a macro for this Just group the sheets ( while holding down the Shift key select the first and the last sheet tab)
Enter the formula in the first sheet Automatically all other sheets will have the formula in the same position Record a macro to automate the process if required
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post |
#3
|
|||
|
|||
Quote:
I agree that I don't need a macro to accomplish this. Seems to be really easy. My intention is to be able to do it with a macro. That way I would like to be able to automate what I'm trying to do. The main purpose is that I can combine it with other macros and run it automatically. I have tried the below code but does not work so I'm getting a Run-time error "1004". Application-define or object-defined error. If someone can help me with this, I will appreciate it. Will keep trying... Code:
Sub Main() Dim ws As Worksheet, c As Long, s$ For Each ws In Worksheets With ws c = .Cells(.Rows.Count, "B").End(xlUp).Row s = "=NF" & "-" & "A1" & Left(B10, 5) & "-" & Mid(B10, 7, 45) & "--Budget 2019" 'Debug.Print s .Range("A10").Formula = s .Range("A10").Copy .Range(.Range("A10"), .Cells(c, "A")) End With Next ws End Sub Thanks all. |
#4
|
|||
|
|||
Code:
s = "=""NF-"" & A$1 & ""-"" & Left(B10, 5) & ""-"" & Mid(B10, 7, 45) & ""--Budget 2019""" |
#5
|
|||
|
|||
Quote:
You are great. Thank you for taking your time with this. It's working great! Much appreciated. Regards, rsrasc |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
RIGHT Function With Concatenate (?) VBA-Need Help with Macro | rsrasc | Excel Programming | 4 | 08-22-2018 12:17 PM |
Concatenate | b16 | Excel | 1 | 01-09-2017 04:51 PM |
concatenate the currency too | isasa74 | Excel Programming | 24 | 12-20-2015 06:01 AM |
Concatenate with @ symbol | anickles | Excel | 2 | 02-06-2015 09:39 AM |
If, move and concatenate in VBA | devcon | Excel Programming | 0 | 07-04-2011 12:44 AM |