ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Specifying a countif function within VB (https://www.excelbanter.com/excel-programming/302699-specifying-countif-function-within-vbulletin.html)

Fish

Specifying a countif function within VB
 
I declared a range within a sheet of data which does the
countif function differentiates between multiple
variables. It works great however, there is an additional
factor in one of my variables that I want it to count only
if that statement is true and not count if its not true.
the statement is two columns to the left.. Thanks for your
help in advance.


''''Code is as follows
Dim IDSrng As Range
Dim Fname As String
Dim GS As String

Fname = ActiveWorkbook.Name

Range(Selection, Selection.End(xlDown)).Name = "IDSrng"

GS = "=COUNTIF(" & "'" & Fname & "'!IDSrng,""Golf Shoes"")"

ActiveWindow.ActivateNext

ActiveCell.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = FOB

''''''''''Here i need to specify to the left 2 columns
'' ''''(activecell.offset(0,-2).select)
'''''if it is either womans or mens golf shoes



All times are GMT +1. The time now is 04:12 PM.

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