Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-18-2016, 09:14 AM
mcronin mcronin is offline Simple Hide columns macro, when I execute it hides everything left of selection, please help Windows 7 64bit Simple Hide columns macro, when I execute it hides everything left of selection, please help Office 2016
Novice
Simple Hide columns macro, when I execute it hides everything left of selection, please help
 
Join Date: May 2016
Posts: 4
mcronin is on a distinguished road
Default Simple Hide columns macro, when I execute it hides everything left of selection, please help

Hi,

I am creating the simplest macro in the world just to hide specific columns, I used macro recorder for speed and when that didn't work I went to the code to make sure it was ok and it looks fine, see below, I can't understand why it continually hides columns A:C when that is clearly not in the code. I also tried doing the hide code for individual column and that didn't work either. Please help and thanks in advance.

Columns("D:K").Select
Selection.EntireColumn.Hidden = True
Reply With Quote
  #2  
Old 08-18-2016, 02:06 PM
NoSparks NoSparks is offline Simple Hide columns macro, when I execute it hides everything left of selection, please help Windows 7 64bit Simple Hide columns macro, when I execute it hides everything left of selection, please help 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

Code:
Columns("D:K").Select
Selection.EntireColumn.Hidden = True
will not hide columns A:C.
Care to show us the rest of your code?
Reply With Quote
  #3  
Old 08-31-2016, 05:15 PM
p45cal's Avatar
p45cal p45cal is offline Simple Hide columns macro, when I execute it hides everything left of selection, please help Windows 10 Simple Hide columns macro, when I execute it hides everything left of selection, please help Office 2010 32bit
Expert
 
Join Date: Apr 2014
Posts: 947
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

I suspect there are merged cells.
You might get away with
Code:
Columns("D:K").entirecolumn.hidden=true
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Code to Hide columns based on selection on prior sheet Silver1379 Excel Programming 0 04-15-2015 08:40 AM
Hide/Unhide Text Based on Drop Down Selection gw1500se Word 3 02-19-2015 12:17 PM
Simple Hide columns macro, when I execute it hides everything left of selection, please help Show/Hide Text based on Checkbox Selection tammytran105 Word VBA 7 10-02-2014 04:30 PM
Simple Hide columns macro, when I execute it hides everything left of selection, please help Hide/Unhide a Block of Text Based on Choice Selection inquirer Word VBA 7 09-22-2014 04:41 PM
Simple Hide columns macro, when I execute it hides everything left of selection, please help How do I call/execute an Excel macro from Access 2003 KramerJ Excel 2 05-11-2009 11:33 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:01 AM.


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