Auto copy record filter result

Tezzin

New Member
Joined
Jun 23, 2020
Messages
6
Office Version
  1. 2013
Platform
  1. Windows
Hi.

So i have made some macros to filter out different faults to show me how many faults there is.
Is there a way to auto copy the amount result to a new cell in a new sheet?

adding 2 pictures of my macro. and the result i want to copy to a new cell.
So every time i press 1 of these buttons i want it to copy the search amount result to a new cell.

sorry for bad English.
 

Attachments

  • macro.PNG
    macro.PNG
    13.7 KB · Views: 5
  • amount.PNG
    amount.PNG
    4 KB · Views: 5

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Records.jpg


Use this method
Place values v and x in the cell

VBA Code:
    Dim v As Long, x As Long, msg As String

    With ActiveSheet.AutoFilter.Range.Resize(, 1)
        v = .SpecialCells(xlCellTypeVisible).Count - 1
        x = .Count - 1
    End With
    msg = v & " of " & x & " records found"
    MsgBox msg, , ""
 
Upvote 0
thank you, as the example above shows the result is 191.But is it possible for it to auto copy paste that value "191" to a different sheet?
 
Upvote 0
View attachment 17463

Use this method
Place values v and x in the cell

VBA Code:
    Dim v As Long, x As Long, msg As String

    With ActiveSheet.AutoFilter.Range.Resize(, 1)
        v = .SpecialCells(xlCellTypeVisible).Count - 1
        x = .Count - 1
    End With
    msg = v & " of " & x & " records found"
    MsgBox msg, , ""

thank you, as the example above shows the result is 191.But is it possible for it to auto copy paste that value "191" to a different sheet?
 
Upvote 0
VBA Code:
Sheets("Different Sheet").Range("A1") = ActiveSheet.AutoFilter.Range.Resize(, 1).SpecialCells(xlCellTypeVisible).Count - 1
 
Upvote 0

Forum statistics

Threads
1,215,482
Messages
6,125,060
Members
449,206
Latest member
Healthydogs

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