![]() |
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 |
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 |
All times are GMT +1. The time now is 06:53 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com