Is there a way of detecting, when printing, that a cell is at the top of the page?
I am not talking about the automatic "Rows to repeat at top" option on Page Setup; I have programmatically suppressed repeating information in Column A but I want to repeat that information if the column is fed to a new page.
When I view a sheet under Page Break Preview, it shows the Page numbers in the centre of the Page. While I am aware that it would not print the page number I was wondering if there is an option to remove/hide the page numbers.
I've written a macro to copy data from a series of columns on one sheet and past it on another sheet in a specific way. However, what I really want to do, is write the macro so it automatically detects what the last column is, either by defining a range consisting of the last column, or by writing "Last Column" in one of the cells of the column, and having the macro detect it.
Dim i As Variant For i = 5 To 56 ' What I want to do is have the second number be the last column, instead of 56. Sheets("MASTER").Select Selection. AutoFilter Field:=i, Criteria1:=">0", Operator:=xlAnd Range("Basic_Data").Copy Sheets(" Consolidate").Select ActiveSheet.Paste ActiveCell.Offset(0, 4).Range("A1").Select Sheets("MASTER").Select...........................
In my company we have many spreadsheets with sections that contain formulas, which may be overwritten with "hard coding", manually entered constants, in certain situations.
Is there a way I can detect the differences between the two types of cells? I would like to setup conditional formatting that would highlight constants in a table that would generally only contains formulas.
It worked well at the time and continues to work well.
The problem I have is that I've copied it for use in a new workbook and for some reason it's not picking up email addresses and storing them in the string "stemails", so that when the email is created there are no addressees. Column BA does have email addresses in it however.
Using Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) I can execute code when values in the cell change, but it can't check if the foreground or background color changes. What event can detect this? If no event can, is there any way at all?
Found this, I will look into this loop: Capturing cell color change in VBA
I execute custom Insert and Delete macros whenever when the user has selected a single contiguous range of rows to insert or delete.
But I don't know how to detect if the user has selected multiple, non-contiguous rows. Is there a way to detect this situation, and if so, is there a way to "loop" through the individual selections?
I've been working on a visualizer for large data sets and I'm trying to create a flexible interface. What I am trying to do is populate a sheet with objects(rectangles, triangles, etc.) and linking them all to the same macro. The macro would detect what had clicked it and read the alternative text which would hold the command procedure for that object. I've seen how people detect cursor position but I have not come across anything to detect the object that was clicked. The code I've found (in another post) is as follows:
Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Type POINTAPI x As Long y As Long End Type
Sub CurosrXY_Pixels()
Dim lngStatus As Long Dim typWhere As POINTAPI
lngStatus = GetCursorPos(typWhere) MsgBox "x: " & typWhere.x & Chr(13) & "y: " & typWhere.y, vbInformation, "Pixels" End Sub
This works but I can't figure out how to detect the object it clicked. I was hoping to use
I need to code a procedure which detects when a cell has changed color (I cannot assume where the cell is).
I thought I might be able to use the worksheet_change procedure, but this only 'reacts' when the cell contents change. Can anyone point me in the direction of the right procedure to implement.
I am working on a workbook in which you can click a button on an index page to create a new sheet in the workbook with the name "meeting" and the number meeting that it is. The new sheet is then added to the index page. I am looking for a way to detect when a sheet is deleted so I can update my index page accordingly. I need to be able to know when a meeting is deleted so I can rename all meetings after that meeting and then update my index.
I want to enable button on the Menu and Toolbar if User is selected entire row (only one row). If it is selected some Range or more than one Row, the button must be disabled. I'm using this to detect what is the user selection:
I am trying to write a macro to paste the data that has been copied onto the clipboard into my worksheet. However I want to paste it in different ways depending on what data is there.
This is what I have so far:
Sub ImportTissue() Sheets("Tissue").Select If "dimensions of clipboard data are 5 cells by 5 cells" Then
How to detect a change in a spreadsheet, but how do i etermine on which cell the change happened?
Basically, I need something like this, if in the range of b1:b30 a cell is changed by the user, let say B??, then change or modify (via a subroutine) cell A??.
Code: Private Sub Worksheet_Change(ByVal Target As Range) ' ' detect which cell in the range b1:b30 changed ' then modify the cell to the right (or left) of the changed cell ' End Sub
I'm using this piece of code to go through Folders and their Subfolders. It works quite well in going through the first folder and its sub's but does not seem to generate a full list.
I am looking for specific files in these folders, and depending in what folder I place the file, it may or may not detect it. I require the code to go at least 3 levels deep (sometimes more).
FolderName = "C: est folder" ProcessFiles FolderName, "*.xls"
Code: '~~> This function was taken from '~~> http://www.vbaexpress.com/kb/getarticle.php?kb_id=245 Sub ProcessFiles(strFolder As String, strFilePattern As String) Dim strFileName As String, strFolders() As String Dim i As Long, iFolderCount As Long
Effectively, I am comparing the values in each set of 47 to determine which one is the smallest. The smallest entry will get a YES label next to it and all others will get a NO. The problem I am having is the the autofill feature is not correctly detecting the pattern, even if I manually fill in the first 49 entries (shown above). If I hilight all of the above entries and autofill one down, I get the following:
Basically I need the H:H: reference to stay constant, but only for 47 cells at a time. After that, both the lower and upper bound should increase by 47. Is there any way to indicate this to Excel? Manually typing in the new formula every 47 entries isn't practical because the spreadsheet has thousands of entries. How I can accomplish this using a single formula and autofill?
I'm trying to make it so that a backup copy of my file is written to floppy when the file is saved (but not with SaveAs). So far, I have the following code, which if the floppy is in the drive works fine, and doesn't error out if the disk is not in the drive. But it doesn't make sure that a backup copy actually got made. How would I check to see if the disk is in the drive and loop somehow until it was so that the file got saved to floppy?
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) On Error Resume Next Application.DisplayAlerts = False If Not (SaveAsUI) Then MsgBox "Please Insert Floppy Disk in Drive A:" ThisWorkbook.SaveCopyAs "A:" & ThisWorkbook.Name End If Application.DisplayAlerts = True End Sub
Is there any formula or macro that can be used to detect the value of the last filled in cell in a column or row? For example, I fill in column B each day with a new numerical variable, so on day one B1 = 100, on day 2 B2 = 200, on day 3 B3 = 150 and so on. I would like the last variable entered in column B to appear in, for example, cell A1. Is there any way to do that?
I have a sheet containing lots of information (lists of flight information to and from all countries). So entries are duplicated in the entire sheet. For example LITHUANIA, USA, CHINA... appears lots of times. I only need to highlight particular countries.
I would just use conditional formatting, but maybe there is a quicker way to do that?
So there is a list of 50 countries in one sheet and in another sheet I got all the info. I need those 50 countries from the list to be highlighted in the info sheet (sheet has many columns and rows).
Is there a way to detect a change of pages in a Multipage form, i.e. is there a change event that is triggered when a user goes from page 1 to page 2? If there is, what does the code look like?
I want to detect if a cell within a range of cell has been modified
A range of cell is named "ChartData" =Data_In_Out!$E$15:$E$29
I understand how to react for a single cell, but not with a group of cells
Code:
Sub Worksheet_Change(ByVal Target As Range) On Error Resume Next If Target.Address = Range("LastBarString").Address Then Application.EnableEvents = False ... ... end if
I have some code that parses an html table. I want to put in error handling in case the format of the page changes or the internet page is unavailable. I am testing without an internet connection and the run time error is not being branched off to the error handler and is fatally ending the macro. This is true also if I raise an error manually.
Private Sub ParseInjuryPage() On Error Goto ErrorHandl Dim strPage As String Dim webIE As SHDocVw.InternetExplorer Dim myURL As String Dim tableBeg As Long Dim tableEnd As Long Dim RowBeg As Long Dim rowEnd As Long Dim cellBeg As Long Dim cellEnd As Long Dim strBeg As Long Dim strEnd As Long Dim myCell As Range Dim rowNum As Integer With Sheets("INJ") Set myCell = .Range("A2") .Range("A:F").Value = vbNullString rowNum = 2 Set webIE = New SHDocVw.InternetExplorer myURL = "http://www.sportsline.com/nfl/injuries" webIE.Navigate myURL Do Until webIE.ReadyState = READYSTATE_COMPLETE DoEvents Loop strPage = webIE.Document.body.innerhtml...................................