VBA copy formula from one cell to the next one

mitenikolov

New Member
Joined
Feb 6, 2020
Messages
6
Office Version
  1. 2016
Platform
  1. Windows
Hello,

Cattura.PNG


This is my Currently Excel Sheet
Cell DP3 contains a Formula that is "CONCATENATE" from another sheet with name "CODICI".

What I would like to do is

1) Copy the formula from the cell DP3 and paste it in cell DQ3 with the numbers + 1.
2) So i the cell DQ3 I would have the following formula: "=CONCATENATE(CODICI!$F$144;" - ";CODICI!$D$144)"

This is what I tried so far but it doesn't seem to work properly
VBA Code:
Range("DP3").Select
Selection.Copy
Range("DQ3").PasteSpecial xlPasteFormulas

Is there a way to get manipulate the formula thought code? I already know how to store it into a String, but I don't know how to change it properly.
Thank you.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Easier just to amend the formula then you can copy or drag across...
Book1
DPDQ
3BBB - AAADDD - CCC
Sheet2
Cell Formulas
RangeFormula
DP3:DQ3DP3=CONCATENATE(INDIRECT("CODICI!F"&COLUMNS($A$1:EM1))," - ",INDIRECT("CODICI!D"&COLUMNS($A$1:EM1)))



Book1
DEF
143AAABBB
144CCCDDD
CODICI
 
Upvote 0
I've come accross an idea: Since I'm using VBA I would like to use this formula
VBA Code:
Worksheets("Sheets").Range(myRange).formula = "=CONCATENATE(CODICI!""" & stringCodiceCella & """ """ & stringDesignazioneCella & """ )"

but I can't make it work. Note that "stringCodiceCella" and "stringDesignazioneCella" are Strings. Can you help me out with it. Thank you
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,271
Members
452,628
Latest member
dd2

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