Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Macro to set the colomns width

Hi,

I would like to create a macro that set the columns width for my Excel form.

It must probably look like what's quoted at the end of this message. The
problem is that it is a macro that is active permenently on the page when you
edit the cells. I want a macro that set the width on demand. Any ideas?
Thx!

Werner

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Select Case Target.Column
Case 1, 3, 5 To 8
Target.ColumnWidth = 2
Case 2, 4
Target.ColumnWidth = 7
End Select
End Sub

--
Message posted via http://www.officekb.com
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 221
Default Macro to set the colomns width

Hello, Jean-Jerome. You can record this macro as long as your columns won't
be moving around.

http://www.officearticles.com/excel/...soft_excel.htm

*******************
~Anne Troy

www.OfficeArticles.com
www.MyExpertsOnline.com


"Jean-Jerome Doucet via OfficeKB.com" wrote in message
...
Hi,

I would like to create a macro that set the columns width for my Excel

form.

It must probably look like what's quoted at the end of this message. The
problem is that it is a macro that is active permenently on the page when

you
edit the cells. I want a macro that set the width on demand. Any ideas?
Thx!

Werner

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Select Case Target.Column
Case 1, 3, 5 To 8
Target.ColumnWidth = 2
Case 2, 4
Target.ColumnWidth = 7
End Select
End Sub

--
Message posted via http://www.officekb.com



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro to set the colomns width

Sub SetColumns()
Dim i as Long
for i = 1 to 8
Select Case i
Case 1, 3, 5 To 8
columns(i).ColumnWidth = 2
Case 2, 4
columns(i).ColumnWidth = 7
End Select
Next
End Sub

--
Regards,
Tom Ogilvy

"Jean-Jerome Doucet via OfficeKB.com" wrote in message
...
Hi,

I would like to create a macro that set the columns width for my Excel

form.

It must probably look like what's quoted at the end of this message. The
problem is that it is a macro that is active permenently on the page when

you
edit the cells. I want a macro that set the width on demand. Any ideas?
Thx!

Werner

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Select Case Target.Column
Case 1, 3, 5 To 8
Target.ColumnWidth = 2
Case 2, 4
Target.ColumnWidth = 7
End Select
End Sub

--
Message posted via http://www.officekb.com



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Macro to set the colomns width

Thank you to both of you. It wolved my problem.

Jean-Jérôme

--
Message posted via http://www.officekb.com
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
macro to keep specific name colomns and delete all others myshak Excel Discussion (Misc queries) 0 March 9th 09 11:01 PM
Delete colomns and rows myshak Excel Worksheet Functions 3 March 7th 09 02:13 AM
colomns got swoeched marrie New Users to Excel 11 September 18th 06 06:02 PM
re-name colomns i.e A,B,C, etc swede Excel Discussion (Misc queries) 4 September 12th 06 06:50 PM
how to merge 2 colomns Narendra Excel Worksheet Functions 1 August 31st 06 07:00 AM


All times are GMT +1. The time now is 08:00 PM.

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

About Us

"It's about Microsoft Excel"