Breakingb0xes
New Member
- Joined
- May 4, 2018
- Messages
- 2
I have a macros I'm writing and I have it a snag. I have the macros create a formula that uses a last name from a designated column. However when it places the formula in the cell, it displays FALSE in the cell, but when I click on the cell it displays the formula I want, it just will not act as a formula. The sub routine is posted below.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim New_set As String
New_set = Range("A12")
Dim Hours
Hours = "=IF(Last!$B$6>0,(Last!$B$6-Last!$B$5)-SUM(Last!$B$7:$B$10),(IF(Last!$B$5="","",$C$1-Last!$B$5-SUM(Last!$B$7:$B$10))))"
If New_set = "Load Formulas" Then
For i = 13 To 17
Dim LastN
Dim p
LastN = Cells(i, 2)
p = Mid(LastN, 1, InStr(1, LastN, ",") - 1)
Cells(i, 3).FormulaArray = Replace(Hours, "Last", p)
Next i
End If
Range("A12") = " "
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim New_set As String
New_set = Range("A12")
Dim Hours
Hours = "=IF(Last!$B$6>0,(Last!$B$6-Last!$B$5)-SUM(Last!$B$7:$B$10),(IF(Last!$B$5="","",$C$1-Last!$B$5-SUM(Last!$B$7:$B$10))))"
If New_set = "Load Formulas" Then
For i = 13 To 17
Dim LastN
Dim p
LastN = Cells(i, 2)
p = Mid(LastN, 1, InStr(1, LastN, ",") - 1)
Cells(i, 3).FormulaArray = Replace(Hours, "Last", p)
Next i
End If
Range("A12") = " "
End Sub