Microsoft Office Forums

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: 4
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
עַם יִשְׂרָאֵל חַי
 
Join Date: Apr 2019
Location: Steamboat Springs
Posts: 112
Alansidman has a spectacular aura aboutAlansidman has a spectacular aura aboutAlansidman has a spectacular aura about
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: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
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
  #5  
Old 11-26-2019, 11:10 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: 4
blakroz is on a distinguished road
Default

Quote:
Originally Posted by Alansidman View Post
Code:
Option Explicit

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

End Sub

It just performs once. I want it to work any time I select a cell not just one time.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Applying shift+space through vba 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

Other Forums: Access Forums

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


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