BrerRabbit
Board Regular
- Joined
- Aug 20, 2023
- Messages
- 84
- Office Version
- 2021
- 2016
- 2013
- Platform
- Windows
I'm copying a number of values from the source worksheet to the table in the destination worksheet using the following code:
This code is working.
The only problem is that the formulas in the adjacent cells in that row of the destination table are being deleted, even though I'm not copying values to the cells with the formulas in them.
I'm trying to use the following code to copy the formula from the cell above it but that isn't working either:
Various examples from various forums suggest using the following code, but I'm unsure how to translate from R1C1 to Cell coding:
How do I resolve this? Thank you in advance.
VBA Code:
Select Case intDCol1
Case 11 To 28
Do While intDCol1 <= intDCol2
Set rngSource = wsSource.Cells(141, intSCol)
Set rngDestGCL = wsDestGCL.Cells(intDRow, intDCol1)
rngDestGCL.Value = rngSource.Value
intDCol1 = intDCol1 + 1
intSCol = intSCol + 1
Loop
The only problem is that the formulas in the adjacent cells in that row of the destination table are being deleted, even though I'm not copying values to the cells with the formulas in them.
VBA Code:
Case 29, 31, 36, 38
intDCol1 = intDCol1 + 1
intSCol = intSCol + 1
I'm trying to use the following code to copy the formula from the cell above it but that isn't working either:
VBA Code:
intDRowLessl = intDRow - 1
Set rngDestGCL = wsDestGCL.Cells(intDRow, intDCol1)
Set rngDestGCLLess1Row = wsDestGCL.Cells(intDRowLessl, intDCol1)
rngDestGCL.Formula = rngDestGCLLess1Row.Formula
Various examples from various forums suggest using the following code, but I'm unsure how to translate from R1C1 to Cell coding:
VBA Code:
Dim lngLastRow as Long 'declare a variable for the last row
lngLastRow = Range("F" & Rows.Count).End(xlUp).Row
Range("G6:G" & lngLastRow).FillDown
How do I resolve this? Thank you in advance.