Hello
What would be the correct Syntax for Column reference when searched by header
'After searching the column name by header name ie i searched the column as "S" as per above formula
'So as per above formula How to have correct syntax for
'' .Range("CL3" & ":CL" & lastRow).Formula = "=SUMIFS('InvSheet'!cfind.Column , 'InvSheet'!A:A,......)
'' And
'' .Range("CL3" & ":CL" & lastRow).Formula = "=SUMIFS(wsInv.cfind.Column , wsInv.column ("A:A").....
Your Help will be highly appreciated
SamD
What would be the correct Syntax for Column reference when searched by header
VBA Code:
Public Sub FormulaWorking()
Dim wsInv as Worksheet
Dim wsMis As Worksheet
Dim SrchtxtStr As String
Set wsMis = Worksheets("MIS")
Set wsInv = Worksheets("InvSheet")
With wsInv.Range("A1:Z1")
SrchtxtStr = "Riveria"
Set cfind = .Find(What:=SrchtxtStr, LookAt:=xlWhole, MatchCase:=False, SearchFormat:=False)
If Not cfind Is Nothing Then
MsgBox SrchtxtStr & vbCrLf & "Is in Col. No " & cfind.Column & " Row No. " & cfind.Row
Else
MsgBox "Not Found in Range"
End If
End With
With wsMis
.Range("CL3" & ":CL" & lastRow).Formula = "=SUMIFS('InvSheet'!S:S,'InvSheet'!A:A,MIS!A:A,'InvSheet'!K:K,MIS!$CL$1)"
End With
End Sub
'After searching the column name by header name ie i searched the column as "S" as per above formula
'So as per above formula How to have correct syntax for
'' .Range("CL3" & ":CL" & lastRow).Formula = "=SUMIFS('InvSheet'!cfind.Column , 'InvSheet'!A:A,......)
'' And
'' .Range("CL3" & ":CL" & lastRow).Formula = "=SUMIFS(wsInv.cfind.Column , wsInv.column ("A:A").....
Your Help will be highly appreciated
SamD