Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 354
Default Macro for workbook

How can I write a macro for work book not for just a worksheet?

How can I write a macro so when i hit a button, it will refresh data with
provided password.

How can I write a macro so it will fix width at data/text to column.

Thanks
Daniel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Macro for workbook

Q1 - How can I write a macro for work book not for just a worksheet?

A1 - When you write code in the VB code module, You can direct it to a
workbook, worksheet, control, UserForm, WebSheet, different application and
various other things, based on how you write the code. The variety is so
vast that it is impractical to provide sample code unless you can tie it down
a little more on what you want to do.

Q2 - How can I write a macro so when i hit a button, it will refresh data
with
provided password.

A2 - Again, the area of coverage is so vast that code sample is impractical.
Define the requirement to a list, Query Table, etc.

Q3 - How can I write a macro so it will fix width at data/text to column.

A3 - This is a sample of one way to set column width. You can also specify
the size in points. You can also use autofit, with line wrap off, so that
Excel will automatically size the cell according to the data it receives.
Sub colWdth()
With Worksheets(1).Columns("B:G")
.ColumnWidth = .ColumnWidth * 2
End With
MsgBox Columns("B").ColumnWidth
End Sub

You can also learn more about writing code at the site below.

http://www.cpearson.com/excel/vbe.htm





"Daniel" wrote:

How can I write a macro for work book not for just a worksheet?

How can I write a macro so when i hit a button, it will refresh data with
provided password.

How can I write a macro so it will fix width at data/text to column.

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
saving macro from workbook to Personal Macro Workbook KrispyData Excel Discussion (Misc queries) 1 March 25th 10 05:52 PM
Combine worksheets in multiple workbook in one workbook with a macro Sam Commar Excel Discussion (Misc queries) 2 April 2nd 09 01:09 PM
Macro to copy an image (or picture) from one workbook to a new sheetin another workbook Ruchir Excel Worksheet Functions 1 July 25th 08 07:29 AM
Running a macro to protect a workbook on a already protected workbook UNprotects the workbook ?? WimR Excel Programming 9 July 25th 05 12:44 PM
Excel Gurus = want a macro in 1 workbook to get info from another workbook = Read please harry Excel Programming 5 December 20th 03 03:26 AM


All times are GMT +1. The time now is 04:56 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"