Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 23rd, 2004, 06:20 AM
Authorized User
 
Join Date: Nov 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to actually select ONE column

Hi
I have two cells that are merged, eg. E1 and F1.
Now I want to choose one column like:
Columns("F:F").Select
Range("F2").Activate
With Selection
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlBottom
    .WrapText = False
    .Orientation = 0
    .AddIndent = False
    .ShrinkToFit = False
End With
No matter how I try, it ends up in selecting both columns.
Anyone got any idea how to fix it?

Thanks in advance
Piblon

 
Old June 25th, 2004, 06:03 AM
Registered User
 
Join Date: Jun 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can't select a column if it contains merged cells.
Alf

 
Old June 29th, 2004, 06:08 AM
Authorized User
 
Join Date: Nov 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok
Thanx

 
Old June 29th, 2004, 06:21 AM
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

However, you don't need to select the range for formatting it. Try this:
Code:
With Columns("F:F")
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlBottom
    .WrapText = False
    .Orientation = 0
    .AddIndent = False
    .ShrinkToFit = False
End With
 
Old June 29th, 2004, 08:34 AM
Authorized User
 
Join Date: Nov 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried the last one and that really did the trick.
Thanks






Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo Box to Show Multi Column Info After Select Coby Excel VBA 0 August 14th, 2007 05:23 PM
Select a Column of DataGrid thomaz C# 0 June 29th, 2005 01:59 PM
Select * from column Mantis MySQL 2 February 25th, 2005 06:14 PM
Select distinct data from one column madkaikar_ashish SQL Server 2000 1 December 17th, 2004 10:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.