'VBA searching for value then convert it to =weeknum
I want to do the following;
It should work as following;
- The code searches all of column A for a date (starting at A3)
- If there is a date, then it would convert it to a week number in (Starting B3) column B
- If there isn't a date found, then it should leave the cell empty
This is what I have so far:
For i = 1 To qColumns
If Range(oColNameE & 3, oColNameE & qRows).Value = vbNullString Then
Range(oColNameF & 3, oColNameF & qRows).Value = ""
Else: Range(oColNameF & 2, oColNameF & qRows).Value = "=weeknum"
End If
Next
Solution 1:[1]
try this one, my comment looks difficult to read.
Dim weeknum as String
weeknum = "=WEEKNUM(RC[-1]-95,11)"
For i = 1 To qCollumns
If Range(oColNameE & 3, oColNameE & qRows).Value = vbNullString Then
Range(oColNameF & 3, oColNameF & qRows).Value = ""
Else: Range(oColNameF & 2, oColNameF & qRows).FormulaR1C1 = weeknum
End If
Next
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | NoobVB |
