PC Review


Reply
Thread Tools Rate Thread

Columns doesnt return expected results

 
 
Roger Smith
Guest
Posts: n/a
 
      21st Mar 2008
I hope this isnt too much of a newbie question... its been years since I
last did any serious VB programming.

I have a body of code that has just finished working with a range of rows
set by:

Rows(4 & ":" & intLastRow).Select ' select all active rows

and now I want to format column A. So I try setting column A to be the
active and selected column with

Columns("A:A").Select ' select column A

however it returns a range of Columns("A:U"). I have also tried
Columns(1).Select and
Range("A:A").activate with the same results.


What am I doing wrong here?

Thanks much


 
Reply With Quote
 
 
 
 
dan dungan
Guest
Posts: n/a
 
      21st Mar 2008
Try
Columns("A:A").NumberFormat = "General"

instead of

Columns("A:A").Select
 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      21st Mar 2008
Do you have those bleeping merged cells in column A to column U?

They can screw up lots of things.

And to make matters worse, each version of excel seems to treat merged cells
differently.

Roger Smith wrote:
>
> I hope this isnt too much of a newbie question... its been years since I
> last did any serious VB programming.
>
> I have a body of code that has just finished working with a range of rows
> set by:
>
> Rows(4 & ":" & intLastRow).Select ' select all active rows
>
> and now I want to format column A. So I try setting column A to be the
> active and selected column with
>
> Columns("A:A").Select ' select column A
>
> however it returns a range of Columns("A:U"). I have also tried
> Columns(1).Select and
> Range("A:A").activate with the same results.
>
> What am I doing wrong here?
>
> Thanks much


--

Dave Peterson
 
Reply With Quote
 
Roger Smith
Guest
Posts: n/a
 
      22nd Mar 2008
Thanks Dave - you nailed it... way down deep in the report there was a
section where A to U was merged. Much thanks to you and a warning to fellow
programmers... those merged cells can indeed really screw things up like
crazy and yield results that, at first glance, seem to be way out of line
with the intended action.

Cheers,

"Dave Peterson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Do you have those bleeping merged cells in column A to column U?
>
> They can screw up lots of things.
>
> And to make matters worse, each version of excel seems to treat merged
> cells
> differently.
>
> Roger Smith wrote:
>>
>> I hope this isnt too much of a newbie question... its been years since I
>> last did any serious VB programming.
>>
>> I have a body of code that has just finished working with a range of rows
>> set by:
>>
>> Rows(4 & ":" & intLastRow).Select ' select all active
>> rows
>>
>> and now I want to format column A. So I try setting column A to be the
>> active and selected column with
>>
>> Columns("A:A").Select ' select column A
>>
>> however it returns a range of Columns("A:U"). I have also tried
>> Columns(1).Select and
>> Range("A:A").activate with the same results.
>>
>> What am I doing wrong here?
>>
>> Thanks much

>
> --
>
> Dave Peterson



 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      22nd Mar 2008
Merged Cells.................the best thing to come along since the Edsel


Gord Dibben MS Excel MVP

On Sat, 22 Mar 2008 15:26:36 -0700, "Roger Smith" <(E-Mail Removed)>
wrote:

>Thanks Dave - you nailed it... way down deep in the report there was a
>section where A to U was merged. Much thanks to you and a warning to fellow
>programmers... those merged cells can indeed really screw things up like
>crazy and yield results that, at first glance, seem to be way out of line
>with the intended action.
>
>Cheers,
>
>"Dave Peterson" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>> Do you have those bleeping merged cells in column A to column U?
>>
>> They can screw up lots of things.
>>
>> And to make matters worse, each version of excel seems to treat merged
>> cells
>> differently.
>>
>> Roger Smith wrote:
>>>
>>> I hope this isnt too much of a newbie question... its been years since I
>>> last did any serious VB programming.
>>>
>>> I have a body of code that has just finished working with a range of rows
>>> set by:
>>>
>>> Rows(4 & ":" & intLastRow).Select ' select all active
>>> rows
>>>
>>> and now I want to format column A. So I try setting column A to be the
>>> active and selected column with
>>>
>>> Columns("A:A").Select ' select column A
>>>
>>> however it returns a range of Columns("A:U"). I have also tried
>>> Columns(1).Select and
>>> Range("A:A").activate with the same results.
>>>
>>> What am I doing wrong here?
>>>
>>> Thanks much

>>
>> --
>>
>> Dave Peterson

>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
V lookup with 2 criteria to return results for multiple columns =?Utf-8?B?SmVuTA==?= Microsoft Excel Worksheet Functions 2 20th Sep 2007 10:04 PM
I need to return mulitple results in several columns please help =?Utf-8?B?SmVycnk=?= Microsoft Excel Misc 0 13th Mar 2006 10:46 PM
Criteria does not return expected results Scott B Microsoft Access Queries 2 15th Jun 2005 02:06 PM
Re: Query doesn't return expected results Brian Camire Microsoft Access Queries 1 3rd Sep 2003 05:45 PM
Query doesn't return expected results Jen Microsoft Access Queries 0 3rd Sep 2003 04:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:47 AM.