Write data back to data sheet

VbaHell

Well-known Member
Joined
Jan 30, 2011
Messages
1,190
Hello all

I think this maybe a big ask but here goes.

The code below looks at the values in the sheet called "Data" and using filters shows the filtered detail on the sheet called "Dashboard"

It is possible please to enter values in the Dashboard sheet that will write back to the Data sheet if that makes sense.

Code:
Sub CopyFltr()
    Dim Rws As Worksheet, Dws As Worksheet
    Dim Ary As Variant
    Dim LR As Long
    
    Application.EnableEvents = False
       
    Sheets("DashBoard").Range("C13:V1048576").ClearContents
    
    Set Rws = Sheets("DashBoard")
    Set Dws = Sheets("Data")
    Ary = Array(Rws.Range("D6"), 2, Rws.Range("D7"), 3, Rws.Range("D8"), 18, Rws.Range("D9"), 19, Rws.Range("F6"), 5, Rws.Range("F7"), 12, Rws.Range("F8"), 13, Rws.Range("F9"), 17)
    If Dws.AutoFilterMode Then Dws.AutoFilterMode = False
    With Dws.Range("A1:V1")
      If Ary(0) <> "" Then .AutoFilter Ary(1), Ary(0)
      If Ary(2) <> "" Then .AutoFilter Ary(3), Ary(2)
      If Ary(4) <> "" Then .AutoFilter Ary(5), Ary(4)
      If Ary(6) <> "" Then .AutoFilter Ary(7), Ary(6)
      If Ary(8) <> "" Then .AutoFilter Ary(9), Ary(8)
      If Ary(10) <> "" Then .AutoFilter Ary(11), Ary(10)
      If Ary(12) <> "" Then .AutoFilter Ary(13), Ary(12)
      If Ary(14) <> "" Then .AutoFilter Ary(15), Ary(14)
      
      .Parent.AutoFilter.Range.Offset(1).Copy Rws.Range("C" & Rows.Count).End(xlUp).Offset(1)
    End With
    Dws.AutoFilterMode = False

        

    Application.EnableEvents = True
End Sub
 

Forum statistics

Threads
1,084,962
Messages
5,380,841
Members
401,699
Latest member
ijazkhan01

Some videos you may like

This Week's Hot Topics

Top