Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default Use BeforeDoubleClick to place 1 or 4 character in a cell

I have simple procedure that uses BeforeDoubleClick to place a green arrow in whatever cell i select.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
With Selection.Font
.Name = "Wingdings 3"
.FontStyle = "Regular"
.Size = 16
.Color = -16776961
End With
Selection.FormulaR1C1 = "ã"
Selection.HorizontalAlignment = xlCenter
Selection.VerticalAlignment = xlCenter
ActiveCell.Offset(1, 0).Range("A1").

I would like to be able to doublelcick through several options, so...

If cell is blank then a double click will produce the green "up" arrow.
When the cell is then the a green arrow, another coulbleclick will produce a green "down" arrow,
if the cell has a green donw arrow, if will produce a red "up" arrow"
if the cell has a red "up" arrow, it wil produce a red "down" arrow.

I have no idea how to "click through" the choices to produce the desired arrow.

Thanks,

Tonso


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Use BeforeDoubleClick to place 1 or 4 character in a cell

Hi Tonso,

Am Sat, 1 Mar 2014 10:12:37 -0800 (PST) schrieb Tonso:

If cell is blank then a double click will produce the green "up" arrow.
When the cell is then the a green arrow, another coulbleclick will produce a green "down" arrow,
if the cell has a green donw arrow, if will produce a red "up" arrow"
if the cell has a red "up" arrow, it wil produce a red "down" arrow.


try:

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

If Len(Target) = 0 Then
With Target
.Value = Chr(227)
.Font.Color = vbGreen
End With
ElseIf Asc(Target) = 227 And Target.Font.Color = vbGreen Then
With Target
.Value = Chr(228)
.Font.Color = vbGreen
End With
ElseIf Asc(Target) = 228 And Target.Font.Color = vbGreen Then
With Target
.Value = Chr(227)
.Font.Color = vbRed
End With
ElseIf Asc(Target) = 227 And Target.Font.Color = vbRed Then
With Target
.Value = Chr(228)
.Font.Color = vbRed
End With
End If
With Target
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
With .Font
.Size = 16
.Name = "Wingdings 3"
End With
End With
Target.Offset(1, 0).Select
End Sub


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Avoid protected cell warning on BeforeDoubleClick WS event Matt[_52_] Excel Programming 0 April 15th 10 12:20 AM
Excel 2007 - Formatting text in cell (character by character) TomC Excel Discussion (Misc queries) 0 January 29th 10 08:25 PM
Place a character in a cell Lisa38 Excel Discussion (Misc queries) 2 December 4th 08 06:34 PM
Replace a character by it's place in a string John Wilson Excel Programming 2 May 1st 07 02:51 AM
lookup specific character place Budwho Excel Worksheet Functions 6 July 20th 05 06:59 PM


All times are GMT +1. The time now is 05:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"