Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Explicit
Sub test()
SelectAlternateColumns 2, 40, 3
End Sub
Sub SelectAlternateColumns(FirstColumn As Integer, _
LastColumn As Integer, Spacing As Integer)
Dim rng As Range
Dim i As Integer
Set rng = Columns(FirstColumn)
For i = FirstColumn To LastColumn Step Spacing
Set rng = Union(rng, Columns(i))
Next i
rng.Select
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel As Boolean)
If Target.Column Mod 3 = 2 Then
MsgBox "One of the columns 2,5,8,11,... was double-clicked"
Else
MsgBox Target.Address & " is not in one of the columns we want."
End If
End Sub