#1
|
|||
|
|||
Applying shift+space through vba
Hi. How can I apply shift+space when selecting a cell using vba? I tried other vba for highlighting but it changes the color of cells and since some of my cells are colorful, it is no use for me. Shift+space is exactly what I'm looking for. That would be great if I can apply it just by selecting a cell. |
#2
|
||||
|
||||
Code:
Option Explicit Sub macroV() Dim trow As Long trow = ActiveCell.Row Rows(trow).Select End Sub |
#3
|
|||
|
|||
Turning on the macro recorder and clicking into cell "C7" then hitting shift + space then stopping the recorder,
the macro Excel/vba produces is only two lines of code Code:
Sub Macro1() ' ' Macro1 Macro ' record shift + space when clicking into a cell ' ' Rows("7:7").Select Range("C7").Activate End Sub This can be done automatically using The Worksheet_SelectionChange event. This event 'triggers' every time a cell is entered and the entered cell is the Target. Right click the sheet tab, click 'View code' and paste this into the sheet module. Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Target.EntireRow.Select Target.Activate End Sub |
#4
|
|||
|
|||
Mine selects a column for ctrl+space. It must be some application optional setting that does that.
Some people like both for a bullseye. Right click the sheet's tab, View Code, and paste. Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Application.EnableEvents = False Union(Columns(Target.Column).EntireColumn, _ Rows(Target.Row).EntireRow).Select Target.Activate Application.EnableEvents = True End Sub |
#5
|
|||
|
|||
Quote:
It just performs once. I want it to work any time I select a cell not just one time. |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
autocorrect double space to single space | frankjake | Word | 8 | 09-21-2018 05:44 PM |
In 2010 document set for no space between paragraphs, but getting large space. | normancamp | Word | 10 | 12-25-2017 04:54 PM |
Night shift and Day shift | Tinbot11 | Project | 1 | 05-09-2016 06:32 PM |
Noob here - I need a shift calendar by days with count of shift. | freeman | Excel | 8 | 09-12-2012 08:45 AM |
How to keep the citation as one unit without using Ctrl+shift+space? | Jamal NUMAN | Word | 3 | 04-24-2011 04:48 PM |