Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I enter formula sum(range+range)*0.15 sumif(range=3) | Excel Discussion (Misc queries) | |||
Excel Addin:Setting the range to the Excel.Range object range prop | Excel Worksheet Functions | |||
Set the text align property of each individual column on UserForm1.ListBox1.ColumnCount = 5 | Excel Programming | |||
Columncount | Excel Programming | |||
how to? set my range= my UDF argument (range vs. value in range) [advanced?] | Excel Programming |