Auto Filter From Sh1 / Sh2

Edgarvelez

Board Regular
Joined
Jun 6, 2019
Messages
197
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

Cant quite figure this one out how to write the last line, I ma not writing it correctly.
I am filtering in sh2 based on sh1.

VBA Code:
    Dim sh1 As Worksheet, sh2 As Worksheet
    Set sh1 = Sheets("DashBoard")
    Set sh2 = Sheets("Sheet1")
    Select Case sh1.Range("B3").Value
    Case "Sheet Line No."
    
   Dim Ary As Variant
With sh1.Range("A7", .Range("A" & Rows.Count).End(xlUp))
         Ary = .Worksheet.Evaluate("transpose(if({1}," & .Address & "&""""))")
      End With
   End With
      Sh2.("Sh1.Range("A2:G2").AutoFilter 1, Ary, xlFilterValues
End Sub
 
You're welcome & thanks for the feedback.
 
Upvote 0

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Hi,

I have a problem, the code worked and filtered correctly, where I am having a problem is that I am running another code afterwards and is not working.
This is the code that I run separately afterwards
VBA Code:
    Dim sh1 As Worksheet, sh2 As Worksheet, sh3 As Worksheet
    Set sh1 = Sheets("DashBoard")
    Set sh2 = Sheets("Sheet1")
    Set sh3 = Sheets("BOL")
  sh2.AutoFilter.Range.Range("C3", sh2.Range("C" & Rows.Count).End(3)).Copy
  sh3.Range("G23").PasteSpecial xlPasteValues
  sh2.AutoFilter.Range.Range("F3", sh2.Range("F" & Rows.Count).End(3)).Copy
  sh3.Range("F23").PasteSpecial xlPasteValues
End Sub

and it does not work, however if I filter the same but manually it works just fine, can't figure this out, can you help.
 
Upvote 0
You already have a thread running for this question, so you need to stick with that thread.
 
Upvote 0
Sorry I was just trying to get this figured out.
Will stick with the other thread and hopefully I can get it solved. Thanks
 
Upvote 0

Forum statistics

Threads
1,215,463
Messages
6,124,965
Members
449,201
Latest member
Jamil ahmed

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