Martin1991
New Member
- Joined
- Nov 14, 2017
- Messages
- 24
Hello,
I m trying to figure out, how to set my formula to skip a similar step after filtering out any values with 0 results. I m searching second day and can´t find any tip for this specific case. I´m beginner with VBA, so i hope it´ll be easy question for you.
To clarify, i got small simple macro, which should fill special cells with some "memo" according the criterial values.
1. Macro filters out, what i need.
2. Fills special cells with "memo".
3. Reset my filters.
Problem is step 2. When filter can´t find defined criteria (because i work daily with another documents, and sometimes there are those criterias, sometimes not), it fills up not only special cells, but every single cell (not only visible) in current column except the first raw, which is header.
What kind of changes would you recommend to me? I think, its about some IF condition, tryed to set it by IF with another formula "y": y = SpecialCells(xlCellTypeVisible).Count ---> If y > 1 Then calculate, but it doesn´t work.
I´m new to the Forum, read all board rules, so i hope its all understandable.
I m trying to figure out, how to set my formula to skip a similar step after filtering out any values with 0 results. I m searching second day and can´t find any tip for this specific case. I´m beginner with VBA, so i hope it´ll be easy question for you.
To clarify, i got small simple macro, which should fill special cells with some "memo" according the criterial values.
1. Macro filters out, what i need.
2. Fills special cells with "memo".
3. Reset my filters.
Problem is step 2. When filter can´t find defined criteria (because i work daily with another documents, and sometimes there are those criterias, sometimes not), it fills up not only special cells, but every single cell (not only visible) in current column except the first raw, which is header.
Code:
Sub HQstatuses()
Sheets("Data").Select
ActiveSheet.UsedRange.AutoFilter Field:=88, Criteria1:=Array( _
"HQ can´t support*", "HQ pending - shortage*"), Operator:=xlFilterValues
ActiveSheet.UsedRange.AutoFilter Field:=65, Criteria1:=Array( _
"Y"), Operator:=xlFilterValues
x = ActiveWorkbook.Sheets("Data").Range("CA1").CurrentRegion.Rows.Count
vzoreccheck = "oow/cid-HQ pending - shortage, please choose a sub with different color"
Range(Cells.SpecialCells(xlCellTypeVisible)(2, 79), Cells.SpecialCells(xlCellTypeVisible)(x, 79)).Value = vzoreccheck
ActiveSheet.Calculate
ActiveSheet.ShowAllData
End Sub
What kind of changes would you recommend to me? I think, its about some IF condition, tryed to set it by IF with another formula "y": y = SpecialCells(xlCellTypeVisible).Count ---> If y > 1 Then calculate, but it doesn´t work.
I´m new to the Forum, read all board rules, so i hope its all understandable.