Ludzik1993
New Member
- Joined
- Oct 8, 2018
- Messages
- 2
Hi everyone,
I have a problem with calling a specific range from a workbook in its specific sheet by having them in the strings and then referring to them in the different workbook by creating a formula in range. (Maybe there is another easier way??)
I need to make it like this because macro is going to be used in files with different names that i can't predict, and i have to copy different ranges from them to other workbook.
Can anyone help?
Thanks!
I have a problem with calling a specific range from a workbook in its specific sheet by having them in the strings and then referring to them in the different workbook by creating a formula in range. (Maybe there is another easier way??)
I need to make it like this because macro is going to be used in files with different names that i can't predict, and i have to copy different ranges from them to other workbook.
Code:
Sub KopiowanieRaportu()
'GENEROWANIE ŚCIEŻKI AKTYWNEGO PLIKU
Dim MF_Name As String
Dim MF_Path As String
MF_Name = Application.ThisWorkbook.Name
MF_Path = Application.ThisWorkbook.Path
'POBIERANIE NUMERU INDEKSU DLA AKTYWNEGO SKOROSZYTU
Dim MF_SheetName As String
MF_SheetName = ActiveSheet.Name
Dim MF_PathToSheet As String
MF_PathToSheet = MF_Path & "\[" & MF_Name & "]" & MF_SheetName & "'!"
Sheets(PG_NazwaSkoroszytu).Range("M2") = MF_PathToSheet
'PRZYPISYWANIE NAZWY PLIKU MIESIECZNYCH TAPORTOW PER SPÓŁKA DO STAŁEJ
Dim MonthyRaport As Workbook
'OTWIERANIE RAPORTU PER SPÓŁKA
Application.DisplayAlerts = False
Set MonthyRaport = Workbooks.Open("Hidden Path :) ")
'KOPIOWANIE MerService
Application.DisplayAlerts = False
Windows("Wykonanie budżetu GRUPA OEX2018").Activate
Sheets("MS_w").Select
Range("K4").Formula = 'HERE I WANT TO REFER TO STRINGS
Can anyone help?
Thanks!