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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
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,215,676
Messages
6,126,173
Members
449,296
Latest member
tinneytwin

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