troubleshooting Question

# Comment Out Code in Excel

Microsoft Excel
Hello Experts,

Very simple one.

Can you please let me know how to comment out some code. I don't want to delete it just don't need it at the moment.

So I have the following code.

Private Sub Worksheet_Calculate()
Dim cel As Range
Dim Addr As Variant, Targ As Variant
Static Stocks(3) As Double      'Starts with element 0
Dim i As Long, n As Long

If ActiveSheet.Range("AQ3").Value > 85 Or ActiveSheet.Range("AV3").Value > 85 Then
Else
End If

Addr = Array("AQ3", "AV3", "AP3", "AU3")    'Watch these cells for price changes
Targ = Array(85, 85, 20, 20)                'Look for prices above these threshhold values
n = UBound(Stocks)
For i = 0 To n
If Not IsError(.Value) Then
If Stocks(i) <> .Value Then
Stocks(i) = .Value
If .Value > Targ(i) Then
Open "C:\Users\User\Documents\ABC.txt" For Append As #1  'Change path & name to suit
Write #1, .Address(False, False), .Value, Date, Format(Time, "hh:mm:ss.ss")
Close 1
End If
End If
End If
End With
Next
End Sub

But I don't need the following at the moment:

Addr = Array("AQ3", "AV3", "AP3", "AU3")    'Watch these cells for price changes
Targ = Array(85, 85, 20, 20)                'Look for prices above these threshhold values
n = UBound(Stocks)
For i = 0 To n
If Not IsError(.Value) Then
If Stocks(i) <> .Value Then
Stocks(i) = .Value
If .Value > Targ(i) Then
Open "C:\Users\User\Documents\ABC.txt" For Append As #1  'Change path & name to suit
Write #1, .Address(False, False), .Value, Date, Format(Time, "hh:mm:ss.ss")
Close 1
End If
End If
End If
End With
Next
End Sub

Just need guidance on how to comment it out.

Cheers

Carlton
Join the community to see this answer!
###### Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.