This "smells" like a simple question, but I've had no luck finding a way to [programmatically] adjust the App.Window to fit around some cells.
I've found "Application.Goto", also the Application.Width/Height setting. The App.Width setting is pixel based, so if there's an easy way to know a cell's pixel-location, that'll work too!
I have the following code working great, however, it only applies to the worksheet that opens when the .xls file first opens. I need it to also apply to all of the sheets in the workbook, in particular sheets titled TNT & Variables
Option Explicit
Private mFormulaBar
Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim oCB As CommandBar For Each oCB In Application.CommandBars oCB.Enabled = True Next oCB
Application.DisplayFormulaBar = mFormulaBar End Sub
Private Sub Workbook_Open() Dim oCB As CommandBar For Each oCB In Application.CommandBars oCB.Enabled = False Next oCB
mFormulaBar = Application.DisplayFormulaBar Application.DisplayFormulaBar = False Application.EnableEvents = True Application.WindowState = xlMaximized ActiveSheet.UsedRange.Select ActiveWindow.Zoom = True Range("salesperson2").Select End Sub
I'm looking for a way to use VBA to set the window size upon opening the workbook. When the document opens, there should be two windows, each taking up half the screen and each on a particular tab.
Currently, if I save the workbook with the window settings I want, when I open it, both windows are maximized. When I hit the restore button, they go back the settings with which they were saved, which is what I want it to look like as soon as it's opened. Also, a bonus would be for the code to determine the screen size, so it can fill the screen no matter what monitor/computer it's opened on.
I am having difficulty locating / composing a script that will set the Main Excel window size? Even better if I could find a way to set the size and position on screen..
I have an Excel based application that needs to run with a screen resolution of 1024*768 in order to display correctly. Is it possible to use VBA to detect the users screen resolution. Then: If the screen resolution is not set to 1024*768 then resize Excel's main window to run at that width and height?
My set up office 2007 win xp pro ie 8 I am using the code below to retrieve web pages etc it works fine, however it display in differ areas of the screen, so I was wondering if there is a way to control the positioning and the size of the window?
Code: Set EXP = CreateObject("InternetExplorer.application") EXP.Visible = True EXP.Navigate (aurl)
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 would like to run some code against the currently selected range of cells in the worksheet, but when I click on the VB button that runs the code, the focus shifts from the worksheet to the VB app, and the cells in the worksheet are no longer selected.
I know this is probably not a question that's come up before, but does anyone have any idea how to retain the 'selected' status of the cells in the worksheet ?
Alright, so I have Excel itself maximized but the window containing the cells doesn't fill the space that it should... if this makes sense, its like the cells have become a subwindow or something ...
I have created a VBA which organizes data from duplicate accounts into a single row so that it is properly formatted for our email system. The one issue I am having trouble handling is cell overflow. Column B cannot end up with more than 5 pieces of information. Each piece of info is seperated by a comma. If there is overflow, the extra data needs to be moved to the following column.
With the example I have provided, you will see that after running the macro, cell B2 has 18 pieces of information. I need to expand the macro so B2 contains 5 pieces, C2 contains 5 pieces, D2 contains 5 pieces, etc.
Is it possible to have different size cells in a single column. For column A I would like to have a width of 30 up to row 20 and then after row 20 I would like a width of 15.
I'm trying to set a range variable ('IngFore') as equal to a number of rows long and a number of columns wide via 'Cells'. The range needs to be dynamic in that the total number of rows and columns will vary over time. Hence, I've defined 'lastdate' to determine the last row in the array, and 'lastcol' to determine the last column in the array. The starting point for the array is I12.
It would appear that I can't quite get the syntax right.
Code: Set IngFore = (Cells(12,9 to lastdate,9)),(Cells(12, 9 to 12, lastcol))
I've tinkered with it here and there, removing and adding brackets but I can't get it to work.
I have a worksheet with a data base type list (16 cols, 10000 rows deep) which contains only 30 records, for testing purposes. Each cell is bordered in all 4 sides.
There will be a bunch or reports associated with this, requiring filtering and/or sorting. The macro instructions I applied so far are:
1) Locate last row. 2) Select the range from first to last row and apply a common row height (say, 24). 3) Sort as required 4) Filter as required. 5) Print
The sorting step has invariably failed. The funny thing is that the code I used is the one produced by recording the steps. I am able to sort that segment manually, but the macro instructions fail.
I am trying to auto size cells depending on the lenght of the data in them. I have added some code in the work book on the attached file, this works on cell that i maunally add data to any where on the active page (template) but the cells that are auto updated with currencey data dont expand?
If you double click column H a list appears select a test and this auto populates the charges accociated with it
Is there a way to do this as it just fills with #### ???
The code in this workbook is below
[code] Private Sub Workbook_SheetChange(ByVal Sh As Object, _ ByVal Target As Range) Dim actCol, curCol
I got a spreadsheet that has a range of used cells from C1:Q1000 but so far only C1:Q100 has been added data so far.
I am trying to get a VB to print range of cells but to fit in 1 page wide and still be readable.
Code: Sub Print_Area() Dim My_Range As String
On Error Resume Next 'enables error handling My_Range = InputBox("Enter the name of the area to print:")
[Code] .......
I have found this piece of code above and works perfectly only thing missing is page formating
Code: With ActiveSheet.PageSetup .FitToPagesWide = 1 .FitToPagesTall = to be dynamic and print if data in cells in as many pages it needs .Zoom = False End With
I have a spreadsheet that will monitor payment schedules, in which both payment frequency and the payment start date are inputted by the user.
As such, to make filling out the column(s) fool-proof, I want to grey out cells in which data should not be entered.
For example, if the payment frequency is every 6th day, and the payments are to begin on day 0, then days 0, 6, 12 (etc) should be left white, whereas the remainder of the cells should be shaded.
I can achieve this using multiple conditional formatting rules in excel2007 with iterations of formulae of the type:
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??
How do i change the default zoom that excel views documents? Whatever view the last person saved the file as it opens in that zoom. I want it to open 75% zoom no matter what anyone saved the files as.
I have text of size 14 and 18 mixed in cells in a column. Cells are font size 18 or mixed with both 14 and 18 size text. I need to sort out the text with one column of size 14 and another of 18 only. I am thinking of copying and pasting the column twice and run a macro in first column to remove the text of size 14, and another macro to delete text of size 18 in second column. I need the leftover text to be in same rows.
I tried everywhere and couldn't find a macro for mixed text cells. I am using Microsoft Excel 2010.
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?
I could need a code (WS code I assume) that open the sheet in 70% zoom every time I open that sheet. For now I get in 75% every time I open it. I guess that WS code will bypass that default setting, or bug, or what ever resets it 75%.
I am developing a form for emergency dispatching. One of the features of this dispatch sheet is that there are several maps in it that open on a seperate form. The map form has 4 maps that are picture files in an image. these images are in a frame. The different images are selected using option buttons. Given the background above, my problem is this. I have code that zooms in 50% each time the Click event for the image is fired. wht i am trying to do is make the zoomed view center where i clicked. this is the code that i have so far but it doesn't work all that spectacular, the closer I zoom in the further out of center the place i clicked gets untill it is out of view.
Private Sub Layout_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) CurrentX = X CurrentY = Y End Sub
Private Sub PlantLayout_Click() If Frame1.Zoom < 400 Then Frame1.Zoom = Frame1.Zoom + 50 frmmap.Frame1.ScrollLeft = CurrentX - (Frame1.Width / 2) frmmap.Frame1.ScrollTop = CurrentY - (Frame1.Height / 2) frmmap.Repaint End Sub