Help with fill down formula not working

Musto85

New Member
Joined
Mar 6, 2022
Messages
21
Platform
  1. Windows
Hey everyone, please see code below, can someone help me identifying why it does not fill down the formula on the "Management" sheet until the end of the list on sheet2?
The last 8 or so names on the table of sheet2 are not appearing on sheet Management?
I've also uploaded two images... Thanks in advance!


VBA Code:
Private Sub Worksheet_Activate()

Application.ScreenUpdating = False

With ThisWorkbook.Sheets("Management")
'.Unprotect ("notnow")

Sheet1.Range("A10").Formula = "=sheet2!A2"
Sheet1.Range("A10:A" & Sheet2.Cells(Rows.Count, 1).End(xlUp).Row).FillDown


'.Protect ("notnow")

Application.ScreenUpdating = True

End With


End Sub

Or if there is any other quicker and easier way to link those cell in the Management sheet with the list on sheet1?
The Management sheet is basically a mirror of that list, however the list on sheet1 changes often and therefore I don't want any REF! appearing on Management sheet and also I want to be able to filter it sometimes so I don't want to just put a formula and fill down until the end otherwise when filtering I will have loads of empty cells at the top.

Thanks in advance
 

Attachments

  • Picture1.png
    Picture1.png
    27.7 KB · Views: 10
  • Picture2.png
    Picture2.png
    49.2 KB · Views: 12

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Maybe this way
VBA Code:
Private Sub Worksheet_Activate()
Application.ScreenUpdating = False
Dim lr As Long
lr = Sheets("Sheet 2").Cells(Rows.Count, 1).End(xlUp).Row 'change sheet name to suit
'.Unprotect ("notnow")
Sheets("Management").Range("A10:A" & lr).Formula = "=sheet2!A2"
'.Protect ("notnow")
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Maybe this way
VBA Code:
Private Sub Worksheet_Activate()
Application.ScreenUpdating = False
Dim lr As Long
lr = Sheets("Sheet 2").Cells(Rows.Count, 1).End(xlUp).Row 'change sheet name to suit
'.Unprotect ("notnow")
Sheets("Management").Range("A10:A" & lr).Formula = "=sheet2!A2"
'.Protect ("notnow")
Application.ScreenUpdating = True
End Sub
Thanks for the reply however that achieves the exact same result. I think I know what's the issue but I'm still not able to resolve it. The data on sheet2 starts from A2 and ends at A81. The fill down formula on Management sheet starts from A10 and goes until A81 and therefore the formula stops at =sheet2!A73.
The table on sheet2 changes, as data gets added or removed so I can't make the range static.

Is there any way to sort this and having the formula on Management sheet until =sheet2!A81 and therefore to reference the exact same last row of the table on sheet2?
 
Upvote 0
Maybe try...
VBA Code:
Private Sub Worksheet_Activate()
    Application.ScreenUpdating = False
    Dim lr As Long

    lr = Sheet2.Range("A2:A" & Sheet2.Range("A" & Rows.Count).End(xlUp).Row).Rows.Count
    'Sheet1.Unprotect ("notnow")
    Sheet1.Range("A10").Resize(lr).Formula = "=sheet2!A2"
    'Sheet1.Protect ("notnow")
    Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0
Solution
VBA Code:
Private Sub Worksheet_Activate()
'
    Application.ScreenUpdating = False
'
    With ThisWorkbook.Sheets("Management")
'        .Unprotect ("notnow")
'
        .Range("A10").Resize(Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row - 1).Formula = "=sheet2!A2"
'
'        .Protect ("notnow")
    End With
'
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Try
Change these lines
VBA Code:
Sheet1.Range("A10").Formula = "=sheet2!A2"
Sheet1.Range("A10:A" & Sheet2.Cells(Rows.Count, 1).End(xlUp).Row).FillDown
By
VBA Code:
Sheet1.Range("A10:A" & Sheet2.Cells(Rows.Count, 1).End(xlUp).Row).Formula = "=sheet2!A2"
 
Upvote 0
If you want copy
VBA Code:
Sheet1.Range("A10").Formula = "=sheet2!A2"
Sheet1.Range("A10").Copy Sheet1.Range("A10:A" & Sheet2.Cells(Rows.Count, 1).End(xlUp).Row)
 
Upvote 0
Maybe try...
VBA Code:
Private Sub Worksheet_Activate()
    Application.ScreenUpdating = False
    Dim lr As Long

    lr = Sheet2.Range("A2:A" & Sheet2.Range("A" & Rows.Count).End(xlUp).Row).Rows.Count
    'Sheet1.Unprotect ("notnow")
    Sheet1.Range("A10").Resize(lr).Formula = "=sheet2!A2"
    'Sheet1.Protect ("notnow")
    Application.ScreenUpdating = True
End Sub
Bingo! thank you very much Mark

Thanks johnny and kvsrinivasamurthy, your variant also work
 
Upvote 0
You're welcome

Thanks johnny and kvsrinivasamurthy, your variant also work
Are you sure about this, as one of them should have the same issue as you had in post number 3
 
Upvote 0

Forum statistics

Threads
1,214,907
Messages
6,122,185
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top