salif_gottem
New Member
- Joined
- Jul 21, 2022
- Messages
- 1
- Office Version
- 2019
- Platform
- Windows
I have a workbook that contains about 50 worksheets with new and deleted worksheets deleted every week, one worksheet, one subcontractor.
Every time I add a new one, I have a VBA Code that create another worksheet with a new name. This is the code :
Now, I need a resume page where there is almost every important information without looking deep into each worksheet.
Why? Because co-workers get lost in all the information when they are looking for one subcontractor (too much legal information involved in too, so it's better less person that can see it.)
So, I made this code :
My problem is that I don't want to copy and paste because if I modify a worksheet I will not see the modifications on the resume page…
I need to make the cells from the resume page equals to the specific worksheets cells.
But my VBA Code works with ActiveSheet so I cannot use :
Every time I add a new one, I have a VBA Code that create another worksheet with a new name. This is the code :
VBA Code:
Sub AddFile()
Dim wb As Workbook: Set wb = ThisWorkbook
Dim ws As Worksheet: Set ws = wb.Sheets("Nouvelle Fiche")
Dim newws As Worksheet, sh As Worksheet, newname
Dim query As Long, xst As Boolean, info As String
retry:
xst = False
newname = Application.InputBox("Entrez le nom de votre nouvelle fiche:", info, , , , , , 2)
If newname = "False" Then Exit Sub
For Each sh In wb.Sheets
If sh.Name = newname Then
xst = True: Exit For
End If
Next
If Len(newname) = 0 Or xst = True Then
info = "Le nom de votre nouvelle fiche est invalide."
GoTo retry
End If
End Sub
Now, I need a resume page where there is almost every important information without looking deep into each worksheet.
Why? Because co-workers get lost in all the information when they are looking for one subcontractor (too much legal information involved in too, so it's better less person that can see it.)
So, I made this code :
VBA Code:
Sub AddResume()
Dim ws As Worksheet: Set ws = Worksheets("Résumé")
Dim LastRow As Long: LastRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1).Row
ActiveSheet.Range("B1").Copy
ws.Cells(LastRow, 1).PasteSpecial xlPasteValues
Application.CutCopyMode = False
For i = 1 To 200
If ws.Cells(i, 1) = ActiveSheet.Range("P3").Value Then
ActiveSheet.Range("P3").Copy
ws.Cells(i, 2).PasteSpecial xlPasteValues
End If
Next
Application.CutCopyMode = False
End Sub
My problem is that I don't want to copy and paste because if I modify a worksheet I will not see the modifications on the resume page…
I need to make the cells from the resume page equals to the specific worksheets cells.
But my VBA Code works with ActiveSheet so I cannot use :
VBA Code:
Sheets("Résumé").Range("B3").Formula = "='SheetName'!P3"