Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
saving macro from workbook to Personal Macro Workbook | Excel Discussion (Misc queries) | |||
Combine worksheets in multiple workbook in one workbook with a macro | Excel Discussion (Misc queries) | |||
Macro to copy an image (or picture) from one workbook to a new sheetin another workbook | Excel Worksheet Functions | |||
Running a macro to protect a workbook on a already protected workbook UNprotects the workbook ?? | Excel Programming | |||
Excel Gurus = want a macro in 1 workbook to get info from another workbook = Read please | Excel Programming |