Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-19-2018, 04:01 AM
byrner byrner is offline Insert a number by double Clicking Windows 10 Insert a number by double Clicking Office 2013
Novice
Insert a number by double Clicking
 
Join Date: May 2018
Posts: 2
byrner is on a distinguished road
Default Insert a number by double Clicking

Hi to All
Just stuck with excel and hoping someone can help?
The code below allows me to insert (0) between columns G and I just by left double clicking,
But i need to extend this to columns V . So it works from columns G to V.
I got this formula from another site but don't really understand it but it works


Thanks again to all

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Intersect(Target, Range("G:I")) Is Nothing Then Exit Sub
Cancel = True
Target.Value = IIf(Target.Value = "", 0, "")
End Sub

Last edited by Pecoflyer; 05-20-2018 at 12:10 AM. Reason: Added code tags
Reply With Quote
  #2  
Old 05-19-2018, 08:35 PM
Logit Logit is online now Insert a number by double Clicking Windows 10 Insert a number by double Clicking Office 2007
Expert
 
Join Date: Jan 2017
Posts: 397
Logit will become famous soon enoughLogit will become famous soon enough
Default

Code:
Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Intersect(Target, Range("G:V")) Is Nothing Then Exit Sub
Cancel = True
Target.Value = IIf(Target.Value = "", 0, "")
End Sub
Reply With Quote
  #3  
Old 05-20-2018, 12:10 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Insert a number by double Clicking Windows 7 64bit Insert a number by double Clicking Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,484
Pecoflyer is a splendid one to beholdPecoflyer is a splendid one to beholdPecoflyer is a splendid one to beholdPecoflyer is a splendid one to beholdPecoflyer is a splendid one to beholdPecoflyer is a splendid one to beholdPecoflyer is a splendid one to behold
Default

@byrner
Hi and welcome to the board.
To make code easier to handle on the forum, it's best to wrap it with code tags ( I did it for you on the first post).
To accomplish this click " go advanced", elect the code and click the #button.
Thanks
Reply With Quote
  #4  
Old 05-20-2018, 02:27 AM
byrner byrner is offline Insert a number by double Clicking Windows 10 Insert a number by double Clicking Office 2013
Novice
Insert a number by double Clicking
 
Join Date: May 2018
Posts: 2
byrner is on a distinguished road
Default Problem Solved

Hi thanks to all , I now have it working Thanks again
Regards
Reply With Quote
  #5  
Old 05-20-2018, 09:07 AM
Logit Logit is online now Insert a number by double Clicking Windows 10 Insert a number by double Clicking Office 2007
Expert
 
Join Date: Jan 2017
Posts: 397
Logit will become famous soon enoughLogit will become famous soon enough
Default

You are welcome.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert a number by double Clicking How do I insert pictures directly into picture boxes by clicking the box instead of using INSERT>PIC Bree Word 1 06-24-2016 10:32 PM
Insert a number by double Clicking Formula cells are not highlighted when double clicking result hockeytown Excel 2 12-03-2015 09:57 AM
Insert a number by double Clicking Can't open Word files when double-clicking JosieNurse Word 9 04-21-2015 11:31 AM
Problem with page and chapter number appearing when clicking in the scroll bar Tango Mike Word 0 05-05-2014 07:12 AM
Insert a number by double Clicking Insert the Hyperlink and hide all sheets except clicking Hyperlink PRADEEPB270 Excel 1 02-22-2013 09:47 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:05 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2021 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft