Help.... Assistance with VBA Code

Bilkhu1980

New Member
Joined
Mar 2, 2015
Messages
3
Hi all

I hope you are all well.... I have a question if anyone could assist.

I have a Excel worksheet for which i have built in some VBA code (shown Below) to show a pop up Calender via a Macro for a selected cell range.

If I was to extend the cells for a wide range of cells for example...

currently the range is AF5:AF10000, I want to add further range of cells like AG5:10000 and AR5:AR10000 and may be a couple more....

My question is how do I extend the Ranges but only on certain Columns (as above)???????


Much appreicated if someone can help.... :)


-----------------------------------------------------------------------------------------------------------------
Private Sub DTPicker21_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date)


End Sub




Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)


If Intersect(Target, Range("AF5:AF10000")) Is Nothing Or Target.Cells.Count > 1 Then
Exit Sub
Else
Run ("OpenCalendar")
End If


End Sub
-------------------------------------------------------------------------
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi,

The basic principle is like this:
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

    If Not Intersect(Target, Union(Columns("A"), Columns("D"), Columns("F"))) Is Nothing Then
        Debug.Print "Found"
    Else
        Debug.Print "Not Found"
    End If

End Sub

I used Columns() and specified columns A, D and F but you could use any range definition, e.g. Range("AF5:AF10000"), instead.
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,525
Members
448,969
Latest member
mirek8991

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top