So i have some cells that move around, but i can find them by referenceing something else. So i want to add these cells together. mnow here is my code. However i can not get excel to calculate it until i click on it. Any help?
Dim MS As String
Dim MSC As String
Dim MF As String
Dim ADD As String
With ActiveSheet.Range("A1:B500")
Set c = .Find("SAL MED SERV Total", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Offset(0, -1).Activate
Selection.Offset(0, 17).Select
MS = ActiveCell.Address
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
With ActiveSheet.Range("A1:B500")
Set c = .Find("SAL MEDICAL ADMIN Total", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Offset(0, -1).Activate
Selection.Offset(0, 17).Select
MSC = ActiveCell.Address
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
With ActiveSheet.Range("A1:B500")
Set c = .Find("SAL MED FACILITIES Total", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Offset(0, -1).Activate
Selection.Offset(0, 17).Select
MF = ActiveCell.Address
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
With ActiveSheet.Range("A1:B500")
Set c = .Find("Grand Total", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Offset(0, 17).Activate
ActiveCell.Formula = MS & "+" & MF & "+" & MSC
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
Dim MS As String
Dim MSC As String
Dim MF As String
Dim ADD As String
With ActiveSheet.Range("A1:B500")
Set c = .Find("SAL MED SERV Total", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Offset(0, -1).Activate
Selection.Offset(0, 17).Select
MS = ActiveCell.Address
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
With ActiveSheet.Range("A1:B500")
Set c = .Find("SAL MEDICAL ADMIN Total", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Offset(0, -1).Activate
Selection.Offset(0, 17).Select
MSC = ActiveCell.Address
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
With ActiveSheet.Range("A1:B500")
Set c = .Find("SAL MED FACILITIES Total", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Offset(0, -1).Activate
Selection.Offset(0, 17).Select
MF = ActiveCell.Address
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
With ActiveSheet.Range("A1:B500")
Set c = .Find("Grand Total", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Offset(0, 17).Activate
ActiveCell.Formula = MS & "+" & MF & "+" & MSC
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With