GerrardSVK
New Member
- Joined
- Sep 18, 2023
- Messages
- 29
- Office Version
- 2016
- Platform
- Windows
Hello All,
can anyone help me? I need to make something very simmilar like code I wrote but I need to change argument F6:F7. So there will be sheet where I need to put exact range and this range will be used in this macro instead of this anytime when I change it. I was thinking about change a cell content into string and then use it in that argument can it be correct (see second code). I need to do some kind of logic like in second code.
can anyone help me? I need to make something very simmilar like code I wrote but I need to change argument F6:F7. So there will be sheet where I need to put exact range and this range will be used in this macro instead of this anytime when I change it. I was thinking about change a cell content into string and then use it in that argument can it be correct (see second code). I need to do some kind of logic like in second code.
VBA Code:
Sub Makro4()
Workbooks(2).ActiveSheet.Range("F6:F7").Copy
Workbooks(1).Sheets(1).Range("F6:F7").PasteSpecial xlPasteValues
End Sub
Code:
Sub Makro1()
Dim Range1 As String
Range1 = ThisWorkbook.Range("C6").Value
Dim Range2 As String
Range2 = ThisWorkbook.Range("C5").Value
Workbooks(2).Sheets(1).Range("Range1").Copy
Workbooks(3).Sheets(1).Range("Range2").PasteSpecial xlPasteValues
End Sub