Forum Discussion
Tirrazo_90
Feb 28, 2023Copper Contributor
Need help to transfer values with currency cells VBA
Hi,
I got this formula and it does everything I need it to, except bringing with it the format of the cell it is copying from to the target cell.
I need the formula to also convert the target cell with the cell format (in this case currency) it gets from the first cell.
Option Explicit
Sub sMoveValues()
Dim i As Long
Application.ScreenUpdating = False
With Sheets("Testark")
'18,22
For i = 1 To 12
.Cells(18, 10 * (i - 1) + 9).Resize(22, 1).Value = _
.Cells(18, 10 * (i - 1) + 10).Resize(22, 1).Value
Next
'58,43
For i = 1 To 12
.Cells(58, 10 * (i - 1) + 9).Resize(43, 1).Value = _
.Cells(58, 10 * (i - 1) + 10).Resize(43, 1).Value
Next
'114, 211
For i = 1 To 12
.Cells(114, 10 * (i - 1) + 9).Resize(211, 1).Value = _
.Cells(114, 10 * (i - 1) + 10).Resize(211, 1).Value
Next
End With
Application.ScreenUpdating = True
End Sub
2 Replies
- NikolinoDEPlatinum Contributor
Attached in the sample file is a quick example to insert the formats.
Would only have to adjust in your code.Hope I could help you with this file/code.
- Tirrazo_90Copper ContributorThank you very much!
Will try it out 🙂