How To Write An API To Control The Zoom Of A Worksheet
Apr 19, 2007
I want to know how to make a spreadsheet automatically control the zoom of a worksheet depending on the size of the screen it is opened on. For example, if it is opened on a screen of a certain size then it will set the zoom to 80% so the worksheet will show only a certain section. I want my worksheets to look the same on even the larger screens and not show the unused rows and columns around the section I am wanting to highlight.
In a previous thread I was told I might need to write an API to help me with achieving this. First of all, what is an API? Secondly, how do I go about writing one?
I know you can predefine the level of zoom you want by using the ActiveWindow.Zoom control. I'm trying to find some code to Zoom in by a particular percentage. For example +10% zoom, so if you are currently on 90%, excel zooms to 100%, click again and then get a zoom of 110%.
I managed to write my script with pretty much the info I could find on the forums (yes!) but I need to write my data to the last row. Columns A - D of the last row will be populated with the content of my variables. This little snipped gives me the first empty row:
How do I write a sub to prevent all changes to a worksheet?
This is part of my thinking in covering all possible mishaps that could occur when working with sheet movement. If I could somehow introduce an active protection on either my Sheets(1) or Sheets("Main"), then I could prevent accidental writing to or removal of said sheet.
I have two userforms. The 1st is called “add a facility” and the second is called “Edit Facility”. The first userform works pretty well. It places all the data in the right columns in the first empty row at the end of the table. Then the “sort” procedure places the “new” facility data in the right category. Everything is good there. Here's the code.
Private Sub CmndInput_Click() Dim iRow As Long Dim ws As Worksheet Set ws = Worksheets("Facilities")
' find first empty row in database iRow = ws. Cells(Rows.Count, 2).End(xlUp).Offset(1, 0).Row
'check for a Facility If Trim(Me.TextFacility.Value) = "" Then Me.TextFacility.SetFocus MsgBox "Please enter a Facility" Exit Sub End If
I have created an excel worksheet that will provide budgeting and estimating tools for my project managers. All data used to be manual entry and took a good while to complete. I am trying to automate the process with VBA.
I created a UserForm called InfoVerify1. On that form I have TextBox 1 - 10. When the UF opens, the boxes display project information from my worksheet called "Basis of Estimate", also known as Sheet26.
The TextBox1 ControlSource is set to "E4". When I run the macro with Sheet26 active, the proper information fills in. However, when I am on the Start page or any other worksheet and I run the macro, it tries to fill in the text boxes with E4, etc, from the active sheet. I tried changing the ControlSource to "Sheet26,E4" or any combo thereof with only error messages.
how to get it to refer to a cell on a particular worksheet and hold to that worksheet no matter which sheet I am on at the time I run the Userform?
When I place an ActiveX TabStrip or a MultiPage onto a spreadsheet, and then try to put a ComboBox onto the TabStrip, the ComboBox will fall behind the TabStrip when I run my pointer across the TabStrip. I used the Arange order from the Draw toolbar to place ComboBox on top and the TabStrip behind, but to no avail. (I would love to use a User Form but lack the VBA know how).
I have a spreadsheet with many cells that require a date. I have added calendar control 11.0 and running it with the code below. The problem is, that everytime the sheet is opened, the calendar gradually gets smaller and smaller each time the workbook is opened. I have tried resizing through formatting the object, but after opening the workbook several times, it's has shrunk down to unusable again.
Private Sub Calendar1_Click() ActiveCell.Value = CDbl(Calendar1.Value) ActiveCell.NumberFormat = "mm/dd/yy" ActiveCell.Select End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Cells.Count > 1 Then Exit Sub If Not Application.Intersect(Range("B161:B184,I161:I184,P161: P184,"), Target) Is Nothing Then Calendar1.Left = Target.Left Calendar1.Top = Target.Top + Target.Height Calendar1.Visible = True ' select Today's date in the Calendar Calendar1.Value = Date ElseIf Calendar1.Visible Then Calendar1.Visible = False End If End Sub
I would like to know if it's possibale to use VB, to auto manage these levels IE, 1 box asks for the part number 2nd asks you how many 3rd/4th boxes are "+", "-" When + or - is pressed the part number will automatically add's/subtracts that part level. I had 10x abcde's I enter 2 in "How Many", then press "-" it will then adjust the level from 10 to 8
I am creating a main worksheet (Legend) in which information will be entered and then populate to other areas (worksheets) within the workbook. I would like to create a print macro - that will run and print all the worksheets that we have selected on the "legend" page. These worksheets would have been selected by ticking a check box.
My question is how to associate a check box to a worksheet? For example - the second worksheet is named " Schedule A" 3rd "Schedule B" and so on.
- The check boxes will be name schedule A, Schedule B and so on. - I would like to associate (link) the checkbox Schedule A with the Worksheet of the same name. Then when this checkbox is selected, and the print macro runs it will print the worksheets that are selected.
I have a database in Sheet1, and need to make a drop-down list for each column title, so that it would filter out the necessary letters or words. E.g. I type "au" and see the words starting "au" in one single list (like aura, aubergine, etc..)
I have a worksheet that has a Calendar on a worksheet from Calendar Control 8.0.
I want to be able to pick a month from the calendar and press a button to convert the selected month into a worksheet. I have a custom made calendar worksheet that I would like for it to be converted into.
I have uploaded my workbook. It contains the custom calendar worksheet as well as the calendar control.
i have a user form with 4 combo boxes and one text box. what i've tried to do is make it so that if the month combo box reads january, then all of the info is placed in a worksheet called january. at the moment it is putting all the info inputted into one sheet. if some one could take a peek at the code below.
If cbomonth.Value = January Then Sheets("January").Select
Do If IsEmpty(ActiveCell) = False Then ActiveCell.Offset(1, 0).Select End If Loop Until IsEmpty(ActiveCell) Or IsEmpty(ActiveCell.Offset(0, 1)) Or IsEmpty.....................
I have set up a calendar control on a userform and got it to pop up when selecting one of 3 cells on a worksheet. The various bits of code making this work are below.
This code is attached to the Userform.
VB: Private Sub Calendar1_Click() With ActiveCell .Value = Calendar1.Value
What I am struggling with is that I'd like to have the calendar that pops up in cell C18 (which is Date of Birth) default to starting on 1st January 1987 not todays date. Also, if there is a value in either of the 3 cells that use the calendar, then I'd like the calendar to display that date. If the cell is empty then todays date is fine for cells G3 and G26.
If I send a workbook out with the zoom set at 90...will the zoom be at 90 when others open it.? Also, is there a worksheet event that I could insert to force a specific worksheet to always open with the zoom at 90??
I have a sub that copies worksheet to a different blank sheet in a different work book. Is there a way for me to set the zoom value on the 2nd sheet (the one being copied to) the same as the 1st sheet?
I have just run into the situation where some users, magically and overnight , have widescreen monitors. This means the screen designs for 4:3 monitors show way too much on 16:9 monitors. I would like to put a control button on the opening page that gives them a choice of zoom, which usually seems to be 100% and 135%.
I'm thinking probably an IF sequence to parse their response and execute the appropriate zoom. But how can I make it effective for all the sheets in a workbook?