Microsoft Office Forums Applying shift+space through vba

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-14-2019, 09:32 PM
blakroz blakroz is offline Applying shift+space through vba Windows 10 Applying shift+space through vba Office 2013
Novice
Applying shift+space through vba
 
Join Date: Apr 2019
Posts: 3
blakroz is on a distinguished road
Question 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.
Reply With Quote
  #2  
Old 09-15-2019, 06:05 AM
Alansidman's Avatar
Alansidman Alansidman is offline Applying shift+space through vba Windows 10 Applying shift+space through vba Office 2019
Advanced Beginner
 
Join Date: Apr 2019
Location: Steamboat Springs
Posts: 46
Alansidman is on a distinguished road
Default

Code:
Option Explicit

Sub macroV()
    Dim trow As Long
    trow = ActiveCell.Row
    Rows(trow).Select

End Sub
Reply With Quote
  #3  
Old 09-15-2019, 06:20 AM
NoSparks NoSparks is offline Applying shift+space through vba Windows 7 64bit Applying shift+space through vba Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 743
NoSparks will become famous soon enoughNoSparks will become famous soon enough
Default

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
The first line selects the entire row and the second activates the cell.

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
Reply With Quote
  #4  
Old 09-15-2019, 06:21 PM
Kenneth Hobson Kenneth Hobson is offline Applying shift+space through vba Windows 10 Applying shift+space through vba Office 2016
Advanced Beginner
 
Join Date: Jun 2018
Posts: 37
Kenneth Hobson is on a distinguished road
Default

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
Reply With Quote
Reply

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
Applying shift+space through vba In 2010 document set for no space between paragraphs, but getting large space. normancamp Word 10 12-25-2017 04:54 PM
Applying shift+space through vba Night shift and Day shift Tinbot11 Project 1 05-09-2016 06:32 PM
Applying shift+space through vba Noob here - I need a shift calendar by days with count of shift. freeman Excel 8 09-12-2012 08:45 AM
Applying shift+space through vba How to keep the citation as one unit without using Ctrl+shift+space? Jamal NUMAN Word 3 04-24-2011 04:48 PM


All times are GMT -7. The time now is 10:46 AM.


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