Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 21st, 2004, 10:06 AM
Authorized User
 
Join Date: Sep 2004
Location: Cork, , Ireland.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cells doubleclick

Hi, do you now:
how to know which cells had a double_click? I am using the name of a range. If I merged the cells there is no problem, but, in some case, I would prefer don't merge them.

Thanks.


Reply With Quote
  #2 (permalink)  
Old September 21st, 2004, 11:11 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , Denmark.
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    MsgBox ActiveCell.Address
End Sub
..tells you which cell have been doubleclicked.

Don't know what your intentions are re. range.
Reply With Quote
  #3 (permalink)  
Old September 22nd, 2004, 02:16 AM
Authorized User
 
Join Date: Sep 2004
Location: Cork, , Ireland.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Birger, this is the code that I have wrote:

Private Sub worksheet_beforedoubleclick(ByVal Target As Excel.Range, _
                                        Cancel As Boolean)
'Block 1
    Set Vrange = Range("Diffusion_Feed_Water")

 'If cells = Diffusion_Feed_Water were pressed:
    If Union(Target, Vrange).Address = Target.Address Then
    …..
    endif


I have the name ("Diffusion_Feed_Water") defined for the group o f cells that I need.
if the range ("Diffusion_Feed_Water") are not merged, it doesn’t work.

Thanks

Reply With Quote
  #4 (permalink)  
Old September 22nd, 2004, 09:49 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , Denmark.
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It's because you're trying to compare a single cell address with a range address.

To my knowledge it's not possible to get the range-name the cell belongs to by activating/clicking the cell. If possible i'd like to know myself.

Consider this. You have 2 named ranges:

  Large=Sheet1!$A$1:$A$3
  Small=Sheet1!$A$2

Which rangename would you expect to receive when you doubleclick cell A2 ?

Merged cells are regarded as one single cell with one address only. The address it receives is the top left cell of all the merged cells. In that case you may compare.
Reply With Quote
  #5 (permalink)  
Old September 28th, 2004, 06:50 AM
Authorized User
 
Join Date: Sep 2004
Location: Cork, , Ireland.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Birger, I will try to use merge so.


Reply With Quote
  #6 (permalink)  
Old September 28th, 2004, 09:00 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , Denmark.
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You're welcome - and a 'not so Pro' workaround could be to change the backcolor of the group. Then read the color when you doubleclick a cell to determing which group it belongs to. There are drawbacks, however (maintenance, overlapping ao), but in some situations it could be used.
Reply With Quote
  #7 (permalink)  
Old September 29th, 2004, 02:52 AM
Authorized User
 
Join Date: Sep 2004
Location: Cork, , Ireland.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I can't use this sugestion in this project (they wouldn't be very impressed with a so colorful screen), but it is another way to do it, and I am sure in the future I will use it.

Thanks birger.


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid Cells Abbas C# 2005 1 October 12th, 2007 09:35 AM
Open Form from MSHFlexGrid DoubleClick neo_jakey Pro VB Databases 1 September 8th, 2004 05:18 AM
Open Form from MSHFlexGrid DoubleClick neo_jakey Pro VB 6 2 September 7th, 2004 10:17 AM
Cells MattLeek Excel VBA 2 December 12th, 2003 11:54 AM
SELECT Doubleclick kilika Classic ASP Basics 1 October 3rd, 2003 04:11 AM



All times are GMT -4. The time now is 01:42 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.