How to find the range of cells till which data is present

Srinatw

New Member
Joined
Jul 1, 2013
Messages
11
Hi,

Greetings Everyone...
Am very new to using Macros in Excel.

Please help on the below query.

In Sheet1, I have two columns named "Test Case" and "Result"
The Test Case column has many rows and new data will get appended as and when required.

I need a way to find out how many rows of data does the column named "Test Case" contains and then need to mention the range for some other calculation.

To be precise,

I need to filter Result column based on its values Pass or Fail and need to copy the filtered data to new sheet.

I need to copy only the rows which are visible after applying the Pass of Fail filter.
How to find the range of cells which are available after applying the filter.

Thanks much in Advance.
Srinatw
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hi..

Say, for example.. your autofilter range is on Sheet1 from "A4:M4".. (thats the first row of auto filtered data below the autofilter header..)

This code will set "myrange" to the range address of the visible range after autofilter...

Code:
  Dim myrange As Range


  Set myrange = Sheets("Sheet1").Range("A4:M" & Cells(Rows.Count, "A").End(xlUp).Row).SpecialCells(xlCellTypeVisible)
  Debug.Print myrange.Address
 
Upvote 0
Hi apo,

Thanks a lot.

Hi..

Say, for example.. your autofilter range is on Sheet1 from "A4:M4".. (thats the first row of auto filtered data below the autofilter header..)

This code will set "myrange" to the range address of the visible range after autofilter...

Code:
  Dim myrange As Range


  Set myrange = Sheets("Sheet1").Range("A4:M" & Cells(Rows.Count, "A").End(xlUp).Row).SpecialCells(xlCellTypeVisible)
  Debug.Print myrange.Address
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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