ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Stop copying down values (https://www.excelbanter.com/excel-programming/433895-stop-copying-down-values.html)

Len

Stop copying down values
 
Hi,

I'm not sure how to modify an excel macro to stop copying down values
from adjacent column when no data found in auto-filtering.

Say, an excel macro is set to copy down data range from A3 to K50 ( ie
the last used cell ) where the auto-filtering set on header J2 to
filter out value 0 in J column.
Excel Macro will copy down values from A3 to K column last used cell
for both data found ( is value 0 ) and no data found ( ie blank
cell ) in filtering column J
How to set excel macro to stop coping down values from A3 to K column
of last used cells, for no data found in column J after filtering the
value 0

Thanks & Regards
Len

joel

Stop copying down values
 
Test the column before applying the filter

set c = columns("B").find(what:="abc", lookin:=xlvalues, lookat:=xlwhole)
if not c is nothing then
columns("B").AutoFilter Field:=1, Criteria1:="abc"
end if

end if

"Len" wrote:

Hi,

I'm not sure how to modify an excel macro to stop copying down values
from adjacent column when no data found in auto-filtering.

Say, an excel macro is set to copy down data range from A3 to K50 ( ie
the last used cell ) where the auto-filtering set on header J2 to
filter out value 0 in J column.
Excel Macro will copy down values from A3 to K column last used cell
for both data found ( is value 0 ) and no data found ( ie blank
cell ) in filtering column J
How to set excel macro to stop coping down values from A3 to K column
of last used cells, for no data found in column J after filtering the
value 0

Thanks & Regards
Len



All times are GMT +1. The time now is 09:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com