m_in_spain
Board Regular
- Joined
- Sep 28, 2018
- Messages
- 64
- Office Version
- 365
- Platform
- Windows
Hello again,
My latest project involves opening another workbook (workbook B), getting the worksheet names, copying them to a list on a sheet ("Main") in workbook A, then creating the same worksheets in workbook A. I have managed to sort this out by scratching around on the internet and putting the following together:
However, what i want to do is to copy data from the sheet in workbook B from cells A5 to A64 from the specific sheet, to the newly created sheet with the same name in workbook A, then move onto the next worksheet.
I have tried and tried and cannot manage to get this extra information.
As ever, any help is much appreciated.
Thanks
My latest project involves opening another workbook (workbook B), getting the worksheet names, copying them to a list on a sheet ("Main") in workbook A, then creating the same worksheets in workbook A. I have managed to sort this out by scratching around on the internet and putting the following together:
VBA Code:
Sub Everything()
Dim mySh As Worksheet, Ws As Worksheet
Dim Wbk As Workbook
Dim i As Long
Dim x As Long
'get value from A7 to get workbook B name
Set Wbk = Workbooks(ThisWorkbook.Sheets("Main").Range("A7").Value)
i = 4 'set at 4 so starts at 5
For Each Ws In Wbk.Worksheets
'get sheet names but not these specific names
If Ws.Visible = xlSheetVisible And Ws.Name <> ("QPriceSheet") And Ws.Name <> ("TotalJobCost") And Ws.Name <> ("Break Out Prices") And Ws.Name <> ("Order Entry") Then
i = i + 1
ThisWorkbook.Sheets("Main").Range("C" & i).Value = Ws.Name
Sheets.Add After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = Ws.Name
End If
Next
ThisWorkbook.Worksheets("Main").Range("A:A,C:C").EntireColumn.AutoFit 'Columns A & C
End Sub
However, what i want to do is to copy data from the sheet in workbook B from cells A5 to A64 from the specific sheet, to the newly created sheet with the same name in workbook A, then move onto the next worksheet.
I have tried and tried and cannot manage to get this extra information.
As ever, any help is much appreciated.
Thanks