Flyingmeatball
Board Regular
- Joined
- Aug 15, 2007
- Messages
- 65
I'm trying to make a dynamic Sumifs function, but using a match function is giving me wrong values. The problem is my columns are dynamic - the data I want won't always be in the same column. However, the header will stay the same. Here is the code I tried running to find which column number I will be searching through:
Sub test()
Dim colnum As Integer
colnum = Application.Match("capital markup", Range("A1:Z1"))
End Sub
However, the match returns strange things. Sometimes it won't find the data at all, and sometimes it returns 17, even if the data is in column C or D. Any suggestions?
Thanks so much!
Sub test()
Dim colnum As Integer
colnum = Application.Match("capital markup", Range("A1:Z1"))
End Sub
However, the match returns strange things. Sometimes it won't find the data at all, and sometimes it returns 17, even if the data is in column C or D. Any suggestions?
Thanks so much!