KlausW
Active Member
- Joined
- Sep 9, 2020
- Messages
- 463
- Office Version
- 2016
- Platform
- Windows
Hi
I have a challenge I would like some help with. I use this VBA code to copy sheets with to a new sheet. With the name from Cell F2. This works really well, now I would like it to be from cells A8 to cells H8 and until there is no text in column A-H. The columns contain formulas.
Anyone who can help?
Any help we would be appreciated
Best Regards
Klaus W
I have a challenge I would like some help with. I use this VBA code to copy sheets with to a new sheet. With the name from Cell F2. This works really well, now I would like it to be from cells A8 to cells H8 and until there is no text in column A-H. The columns contain formulas.
Anyone who can help?
Any help we would be appreciated
Best Regards
Klaus W
VBA Code:
Private Sub MM1()
Application.ScreenUpdating = False
'----------/Døber variable/--------------'
Dim CopyWb As Workbook, PasteWB As Workbook
Dim CopyWS As Worksheet, PasteWS As Worksheet
Dim NameCell As Range
Dim Name As String
'----------/Tildeler variable indhold/--------------'
Set CopyWb = ThisWorkbook
Set CopyWS = CopyWb.Sheets("Bestilling")
Set NameCell = CopyWS.Range("f2")
Set PasteWB = Workbooks.Add
Set PasteWS = PasteWB.Sheets(1)
Name = NameCell.Value
'----------/Navngiver ark 1/--------------'
PasteWS.Name = CopyWS.Name
'----------/Tager en kopi af cellerne i "bestilling"/--------------'
CopyWS.Cells.Copy
'----------/formaterer og overfører data til det nye ark/--------------'
PasteWS.Cells.PasteSpecial xlPasteValues
PasteWS.Cells.PasteSpecial xlPasteFormats
'PasteWS.Rows("9").Select
'ActiveWindow.FreezePanes = True
PasteWS.Range("A1").Select
Application.CutCopyMode = False
'----------//--------------'
Application.ScreenUpdating = True
Application.Dialogs(xlDialogSaveAs).Show Name, 51
’Hide_Gridlines
End Sub