问题
I have a large workbook that contains a list of dates in column "A" of Sheet1. Is there a way to search the column for a specific date, count how many rows down it is, then set that number as a variable that I can use in a range in the next bit of VBA code?
Basically, I want to be able to find the row number associated with the date, then reference that row later on.
回答1:
Here you go...
Dim MyDate&, TheRow&
MyDate = DateSerial(2015, 4, 11)
TheRow = Application.Match(MyDate, Sheet1.[a:a], 0)
来源:https://stackoverflow.com/questions/33487865/search-column-for-value-and-count-number-of-rows