Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 354
Default format all column width

How can I write a macro so that it can format all column width equal to
standard
or exp=20
THe funtion if nice should apply for all sheets in a workbook?

Thanks
Daniel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 354
Default format all column width

Thanks Tom

If I have an existing sub, I just have to add below phase to my sub ?

for each sh in activeworkbook.Worksheets
sh.Columns.ColumnWidth = 8.43

Thanks

"Tom Ogilvy" wrote:

Sub SetColumnWidth()

for each sh in activeworkbook.Worksheets
sh.Columns.ColumnWidth = 8.43
Next

end Sub

--
Regards,
Tom Ogilvy

"Daniel" wrote:

How can I write a macro so that it can format all column width equal to
standard
or exp=20
THe funtion if nice should apply for all sheets in a workbook?

Thanks
Daniel

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default format all column width

Most yes - but to be complete

for each sh in activeworkbook.Worksheets
sh.Columns.ColumnWidth = 8.43
next sh

--
Regards,
Tom Ogilvy


"Daniel" wrote:

Thanks Tom

If I have an existing sub, I just have to add below phase to my sub ?

for each sh in activeworkbook.Worksheets
sh.Columns.ColumnWidth = 8.43

Thanks

"Tom Ogilvy" wrote:

Sub SetColumnWidth()

for each sh in activeworkbook.Worksheets
sh.Columns.ColumnWidth = 8.43
Next

end Sub

--
Regards,
Tom Ogilvy

"Daniel" wrote:

How can I write a macro so that it can format all column width equal to
standard
or exp=20
THe funtion if nice should apply for all sheets in a workbook?

Thanks
Daniel

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default format all column width

Daniel
Include the "Next" line as well. HTH Otto
"Daniel" wrote in message
...
Thanks Tom

If I have an existing sub, I just have to add below phase to my sub ?

for each sh in activeworkbook.Worksheets
sh.Columns.ColumnWidth = 8.43

Thanks

"Tom Ogilvy" wrote:

Sub SetColumnWidth()

for each sh in activeworkbook.Worksheets
sh.Columns.ColumnWidth = 8.43
Next

end Sub

--
Regards,
Tom Ogilvy

"Daniel" wrote:

How can I write a macro so that it can format all column width equal to
standard
or exp=20
THe funtion if nice should apply for all sheets in a workbook?

Thanks
Daniel



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 354
Default format all column width


Don't know why it's not works. I have diferent column widths ??
Daniel

"Otto Moehrbach" wrote:

Daniel
Include the "Next" line as well. HTH Otto
"Daniel" wrote in message
...
Thanks Tom

If I have an existing sub, I just have to add below phase to my sub ?

for each sh in activeworkbook.Worksheets
sh.Columns.ColumnWidth = 8.43

Thanks

"Tom Ogilvy" wrote:

Sub SetColumnWidth()

for each sh in activeworkbook.Worksheets
sh.Columns.ColumnWidth = 8.43
Next

end Sub

--
Regards,
Tom Ogilvy

"Daniel" wrote:

How can I write a macro so that it can format all column width equal to
standard
or exp=20
THe funtion if nice should apply for all sheets in a workbook?

Thanks
Daniel






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 354
Default format all column width

Can I write sub in sub

sub ABC()


sub setcolumnwidht()
end sub
......
.......
end sub


Thanks
Daniel

"Daniel" wrote:


Don't know why it's not works. I have diferent column widths ??
Daniel

"Otto Moehrbach" wrote:

Daniel
Include the "Next" line as well. HTH Otto
"Daniel" wrote in message
...
Thanks Tom

If I have an existing sub, I just have to add below phase to my sub ?

for each sh in activeworkbook.Worksheets
sh.Columns.ColumnWidth = 8.43

Thanks

"Tom Ogilvy" wrote:

Sub SetColumnWidth()

for each sh in activeworkbook.Worksheets
sh.Columns.ColumnWidth = 8.43
Next

end Sub

--
Regards,
Tom Ogilvy

"Daniel" wrote:

How can I write a macro so that it can format all column width equal to
standard
or exp=20
THe funtion if nice should apply for all sheets in a workbook?

Thanks
Daniel




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default format all column width

Not much point in writing Sub in Sub, you can just write the lines of code to
do the job. However, if you want to only run a procedure under certain
conditions, or if you want to break a large procedure into several smaller
procedures, then you can call the sub routines from a main procedure by
simply using their name on a single line if they are in the same workbook:

Sub Main()
Range("A1").Activate
'Do Things
ABC 'Calls sub routine ABC and will return to next line after execution.
'Do more things
End Sub

See also "Call Statement" in VBA help file.



"Daniel" wrote:

Can I write sub in sub

sub ABC()


sub setcolumnwidht()
end sub
.....
......
end sub


Thanks
Daniel

"Daniel" wrote:


Don't know why it's not works. I have diferent column widths ??
Daniel

"Otto Moehrbach" wrote:

Daniel
Include the "Next" line as well. HTH Otto
"Daniel" wrote in message
...
Thanks Tom

If I have an existing sub, I just have to add below phase to my sub ?

for each sh in activeworkbook.Worksheets
sh.Columns.ColumnWidth = 8.43

Thanks

"Tom Ogilvy" wrote:

Sub SetColumnWidth()

for each sh in activeworkbook.Worksheets
sh.Columns.ColumnWidth = 8.43
Next

end Sub

--
Regards,
Tom Ogilvy

"Daniel" wrote:

How can I write a macro so that it can format all column width equal to
standard
or exp=20
THe funtion if nice should apply for all sheets in a workbook?

Thanks
Daniel



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
Column width format falcios Excel Discussion (Misc queries) 2 February 7th 10 06:21 AM
format all column width Tom Ogilvy Excel Programming 0 September 28th 07 07:43 PM
Format Painter Column Width Sam Excel Discussion (Misc queries) 3 September 13th 07 12:20 AM
Format Exact Column Width klpc1 Excel Discussion (Misc queries) 5 February 24th 07 09:33 PM


All times are GMT +1. The time now is 03:33 PM.

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"