Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default columncount and range?


Hi,

I have a some columns from which the columnwidth should be changed. I
have written a piece of code to do that, but I get an error when using
it. I found out that iLastColumn3 gives the outcome "20" instead of
"T".
How should I change the code to get it working? Thanks in advance!


Code:
--------------------
iLastRow3 = Cells(Rows.Count, "B").End(xlUp).Row
iLastColumn3 = Cells(iLastRow3, Columns.Count).End(xlToLeft).Column
Columns("B:B").ColumnWidth = 10
Columns("C", iLastColumn3).ColumnWidth = 9.14
--------------------


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=566638

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default columncount and range?

Columns should work with integers as well try:
Columns(3,iLastColumn3).ColumnWidth = 9.14

Die_Another_Day
leonidas wrote:
Hi,

I have a some columns from which the columnwidth should be changed. I
have written a piece of code to do that, but I get an error when using
it. I found out that iLastColumn3 gives the outcome "20" instead of
"T".
How should I change the code to get it working? Thanks in advance!


Code:
--------------------
iLastRow3 = Cells(Rows.Count, "B").End(xlUp).Row
iLastColumn3 = Cells(iLastRow3, Columns.Count).End(xlToLeft).Column
Columns("B:B").ColumnWidth = 10
Columns("C", iLastColumn3).ColumnWidth = 9.14
--------------------


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=566638


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default columncount and range?

Columns("C:C").Resize(,iLastColumn3-2).ColumnWidth = 9.14

--
Regards,
Tom Ogilvy

"leonidas" wrote:


Hi,

I have a some columns from which the columnwidth should be changed. I
have written a piece of code to do that, but I get an error when using
it. I found out that iLastColumn3 gives the outcome "20" instead of
"T".
How should I change the code to get it working? Thanks in advance!


Code:
--------------------
iLastRow3 = Cells(Rows.Count, "B").End(xlUp).Row
iLastColumn3 = Cells(iLastRow3, Columns.Count).End(xlToLeft).Column
Columns("B:B").ColumnWidth = 10
Columns("C", iLastColumn3).ColumnWidth = 9.14
--------------------


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=566638


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default columncount and range?

Just a heads up:
Columns doesn't accept two integer arguments to the best of my knowledge.


Maybe
Range(cells(1,3),cells(1,iLastcolumn3)).Entirecolu mn.ColumnWidth = 9.14

--
Regards,
Tom Ogilvy


"Die_Another_Day" wrote:

Columns should work with integers as well try:
Columns(3,iLastColumn3).ColumnWidth = 9.14

Die_Another_Day
leonidas wrote:
Hi,

I have a some columns from which the columnwidth should be changed. I
have written a piece of code to do that, but I get an error when using
it. I found out that iLastColumn3 gives the outcome "20" instead of
"T".
How should I change the code to get it working? Thanks in advance!


Code:
--------------------
iLastRow3 = Cells(Rows.Count, "B").End(xlUp).Row
iLastColumn3 = Cells(iLastRow3, Columns.Count).End(xlToLeft).Column
Columns("B:B").ColumnWidth = 10
Columns("C", iLastColumn3).ColumnWidth = 9.14
--------------------


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=566638



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default columncount and range?

That's interesting. I've used that with Rows and it works fine. I
wonder why 1 dimension supports it and the other dimension doesn't.
Rows("1:10").Delete

Die_Another_Day
Tom Ogilvy wrote:
Just a heads up:
Columns doesn't accept two integer arguments to the best of my knowledge.


Maybe
Range(cells(1,3),cells(1,iLastcolumn3)).Entirecolu mn.ColumnWidth = 9.14

--
Regards,
Tom Ogilvy


"Die_Another_Day" wrote:

Columns should work with integers as well try:
Columns(3,iLastColumn3).ColumnWidth = 9.14

Die_Another_Day
leonidas wrote:
Hi,

I have a some columns from which the columnwidth should be changed. I
have written a piece of code to do that, but I get an error when using
it. I found out that iLastColumn3 gives the outcome "20" instead of
"T".
How should I change the code to get it working? Thanks in advance!


Code:
--------------------
iLastRow3 = Cells(Rows.Count, "B").End(xlUp).Row
iLastColumn3 = Cells(iLastRow3, Columns.Count).End(xlToLeft).Column
Columns("B:B").ColumnWidth = 10
Columns("C", iLastColumn3).ColumnWidth = 9.14
--------------------


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=566638






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default columncount and range?

columns("A:J") does work - but that is one arguement. Also 1:10 means
rows, not columns - so I suspect that is "consistent" with Range - but I
agree it isn't always intuitive

Range("1:10")
Range("A:J")

--
Regards,
Tom Ogilvy






"Die_Another_Day" wrote:

That's interesting. I've used that with Rows and it works fine. I
wonder why 1 dimension supports it and the other dimension doesn't.
Rows("1:10").Delete

Die_Another_Day
Tom Ogilvy wrote:
Just a heads up:
Columns doesn't accept two integer arguments to the best of my knowledge.


Maybe
Range(cells(1,3),cells(1,iLastcolumn3)).Entirecolu mn.ColumnWidth = 9.14

--
Regards,
Tom Ogilvy


"Die_Another_Day" wrote:

Columns should work with integers as well try:
Columns(3,iLastColumn3).ColumnWidth = 9.14

Die_Another_Day
leonidas wrote:
Hi,

I have a some columns from which the columnwidth should be changed. I
have written a piece of code to do that, but I get an error when using
it. I found out that iLastColumn3 gives the outcome "20" instead of
"T".
How should I change the code to get it working? Thanks in advance!


Code:
--------------------
iLastRow3 = Cells(Rows.Count, "B").End(xlUp).Row
iLastColumn3 = Cells(iLastRow3, Columns.Count).End(xlToLeft).Column
Columns("B:B").ColumnWidth = 10
Columns("C", iLastColumn3).ColumnWidth = 9.14
--------------------


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=566638




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default columncount and range?

Well it makes a little more sense now. It does work with 2 Letters...
Columns("A:J").Delete

Whatever gets the job done. I like that offset idea though Tom.

Die_Another_Day
Die_Another_Day wrote:
That's interesting. I've used that with Rows and it works fine. I
wonder why 1 dimension supports it and the other dimension doesn't.
Rows("1:10").Delete

Die_Another_Day
Tom Ogilvy wrote:
Just a heads up:
Columns doesn't accept two integer arguments to the best of my knowledge.


Maybe
Range(cells(1,3),cells(1,iLastcolumn3)).Entirecolu mn.ColumnWidth = 9.14

--
Regards,
Tom Ogilvy


"Die_Another_Day" wrote:

Columns should work with integers as well try:
Columns(3,iLastColumn3).ColumnWidth = 9.14

Die_Another_Day
leonidas wrote:
Hi,

I have a some columns from which the columnwidth should be changed. I
have written a piece of code to do that, but I get an error when using
it. I found out that iLastColumn3 gives the outcome "20" instead of
"T".
How should I change the code to get it working? Thanks in advance!


Code:
--------------------
iLastRow3 = Cells(Rows.Count, "B").End(xlUp).Row
iLastColumn3 = Cells(iLastRow3, Columns.Count).End(xlToLeft).Column
Columns("B:B").ColumnWidth = 10
Columns("C", iLastColumn3).ColumnWidth = 9.14
--------------------


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=566638



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default columncount and range?


Hi,

The same problem but then with rows. I have tried the code below, but
it doesn't work.
How should I change the code to get it to work. Thanks in advance!


Code:
--------------------
iLastRow3 = Cells(Rows.Count, "B").End(xlUp).Row
Rows("10:10").Resize(, iLastRow3).RowHeight = 15.75
--------------------


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=566638

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default columncount and range?

Just a guess but swap the "," and "iLastRow3" in the Resize function,
the normal syntax is Row, Column. Therefore the Columns resize worked
fine but the Rows needs changed

Die_Another_Day
leonidas wrote:
Hi,

The same problem but then with rows. I have tried the code below, but
it doesn't work.
How should I change the code to get it to work. Thanks in advance!


Code:
--------------------
iLastRow3 = Cells(Rows.Count, "B").End(xlUp).Row
Rows("10:10").Resize(, iLastRow3).RowHeight = 15.75
--------------------


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=566638


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I enter formula sum(range+range)*0.15 sumif(range=3) tkw Excel Discussion (Misc queries) 2 October 1st 09 09:17 PM
Excel Addin:Setting the range to the Excel.Range object range prop Rp007 Excel Worksheet Functions 5 November 24th 06 04:30 PM
Set the text align property of each individual column on UserForm1.ListBox1.ColumnCount = 5 Drom Excel Programming 2 October 21st 05 10:21 AM
Columncount Christian Davidsson[_2_] Excel Programming 3 November 18th 03 10:02 AM
how to? set my range= my UDF argument (range vs. value in range) [advanced?] Keith R[_3_] Excel Programming 2 August 11th 03 05:55 PM


All times are GMT +1. The time now is 02:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"