Run Macro When Range Value Not Blank, If Not Run Other Macro First
Oct 10, 2008
I wanted to modify the below macro but don't know how. Could someone help me please? Please see the bold text below.
Dim shortmonth As String
Dim todaysdate As String
Dim enterdate As String
'GET DATE AND CREATE VARIABLES
enterdate = InputBox("Please enter the date in the following format: MMDD")
shortmonth = Left(enterdate, 2)
todaysdate = Mid(enterdate, 3, 2)
1st - Need a macro to change a range of cells colours based on a single cell having a value greater than 0.001. ie. cells A1 - G1 need to change to grey based on cell F1 having a value greater than 0.001 entered in it?
2nd - Also a macro for deleting the text contents of cell C1 based on cell F1 having a value greater than 0.001. Therefor if cell F1 has a number greater than 0.001 it changes the colour of celss A1 - G1 and also deletes the text in cell C1?
I am looking for a macro that will go to the next blank cell in the column starting at B3 and if none are found going to the next sheet(sheets are january-december). The twist is that I need it to change sheets when there is nothing in column A(which has dates and times in it) then go again to the next blank cell in the following sheet starting at B3.
I have a macro that runs when the user clicks on a button. I want it to run when a particular cell has data in it - after the user selects an item from a drop down. How can I make the macro trigger based on a cell being non-blank?
I have a customer data file in which some cells have been completed with x's and I need to replace any cell that contains x's with a blank.
I can easily do this when the cell contains a single x by using find and replace within the macro, but some customers have completed fields with xx or xxx or xxxx and so on - these x's may be in upper or lower case.
I can't just replace all instances of x (or X) with blank on partial cells as there will be company names or address details that will contain an x.
What I need is a way to identify cells that contain ONLY x character(s): so "x" would be replaced with blank as would "xx", "xxx" etc., but "XYZ Limited", "LOXX & Co." or "Essex" need to be left as is.
I can't even think where to begin on this. Anyone got any bright ideas or can point me in the right direction?
I have a worksheet that contains data but column E has blank cells. i want to automatically encode on the last blank cell in column E up to the last used row.
I am using the ff. code to select the last blank cell in column E:
Range("E1").End(xlDown).Offset(1, 0).Select
I am using the ff. code to select the last used row:
ActiveSheet.UsedRange.Rows.Select
but it doesn't work.
In my excel file, all i want to do is to encode "ECASE-UNUSABLE-UPD" in cell E61:1549 , wherein E61 = is the last blanck cell & E1549 = is the last used row.
provide me a macro to give a particular message or Cell Name when the cell is blank. I have to check around Eight columns and the starting row is A10. Moreover the sheet can have different numbers of row at different time like some time only 50 persons data will be there and some times 60 or 85 like this but the maximum will be 300. So if the 50 persons data is there than it should not warn about row 51 onwards.
I have a spreadsheet where I had a new column on a daily basis. I am trying to create a macro to automate some parts of this. I would like to select the next blank cell on row 1. So in this instance, cell M1, however the following day it would be N1. This is the part I am unsure of how to do. After this I will be doing a vlookup to add the new values, which I should be able to sort out no problem.
I have seen people using COUNT and OFFSET to select the last cell +1, however I am unsure how to link to two together.
I am try to write a bit of code which will find the non blank cells in column H (Range H4:H24) and when it finds a non blank cell make column C in that row the active cell and then run a macro. Once the macro as been run i would like it to look for the next non blank cell.
I need to write a macro that will successfully delete blank rows. I also need to write a macro that will successfully delete duplicates. The duplicates are numbers and they do constantly change.
I am able create a macro using the find function to find the next blank row, but I would like to have it select a range of rows down that I can then delete. Each time I run the macro the next blank row may be different thant the last, so it can't be a set number of row numbers each time. I could also possibly use the print area function if it would be easier.
Here is what I have so far, what is in red is where I need it to vary from next active blank row down to R2001C14, and then delete all the active blank rows ...
I have searched the forum a few times and haven't seen an exact example of what I am trying to do, so I hope this isn't a duplicate.
I am looking for a macro to copy a cell and autofill it down the column until it gets to a non-blank cell. When it reaches that cell it needs to then copy THAT cell down until it reaches another non-blank cell... this could happen just a couple times, a couple dozen times, or only the very first time.
So for example:
In cell B2 there is text "Data1" In cell B13 there is text "Data2" In cell B25 there is text "Data3"
I would like the macro to search column B to find "Data1", and then copy it down the column until it reaches B13, then copy "Data2" down until B25, where it would then copy "Data3" down until the end of the document. The location of the data in column B varies, and the number of cells with data in column B will vary as well.
I wonder if soeone could change the following macro so that the bottomcell is set to be as far down as there is content in Column "A". As it stands if I fill in blank cells in Column "C" and the last cell with data is say C10 it does just this. But if the actual last row with data in column "A" is A14 then cells C11, C12, C13, and C14 are ignored. C11, C12, C13, and C14 should be the same as C10 above them.
Sub FillBlankCells() Dim topcell As Range, bottomcell As Range Set topcell = Cells(1, ActiveCell.Column) Set bottomcell = Cells(16384, ActiveCell.Column) If IsEmpty(topcell) Then Set topcell = topcell.End(xlDown) If IsEmpty(bottomcell) Then Set bottomcell = bottomcell.End(xlUp).Offset Range(topcell, bottomcell).Select Selection.SpecialCells(xlBlanks).Select Selection.FormulaR1C1 = "=R[-1]C" End Sub
Other macros recognize the actual last row.... but have issues with columns formatted as Text. The macro above doesn't create problems with columns formatted as "Text".
I'm using a macro to send the contents of a sheet to an html file. The problem I am having is that for some reason it is not recognizing the blank cells in the last column (column 9) of the sheet, thus I am not getting the " " that I need in the html code. The code for column 7 works fine and is identical. I did a test and selected column 9, right clicked, and "Cleared Contents". When I ran the macro again it worked fine. The problem is that sometimes there may be data in column 9, so I can't clear it. Here's the code I'm using. Is there another condition I can use to look for a blank cell or something I can do to the spreadsheet for my code to work?
If Cells(i, 9) = "" Then a.writeline " <td valign=""top""> </td>" Else a.writeline " <td valign=""top"">" & Cells(i, 9).Text & "</td>" End If
How can I have my macro run in its cell and still allow the cell to be blank? Say I have a number, 0.99, in the cell and I want to delete it and leave it blank. I can either push "Backspace" or the delete key and it still leaves zeros.
If I push the space bar it stops the macro (which I do not want to happen) and leaves the cell blank because I added a space.
I am looking for some VBA programming that will allow me to use 1 button to consolidate rows (delete them). The problem I am running into is that the rows I want to delete have formulas in them so I can use "find all blank cells & delete" type of macro.
Capture.PNGCapture1.PNG
Attached are a couple of brief images on a small scale what I am looking to do.
I want a user to be able to have this sporadic list of choices, consolidate them so the are all one right after each other, then export to a word file for editing later on.
I am looking for a macro that will copy the row above it, to include formatting and formulas, however not the actual contents. I need the row that's being copied to be hidden from view, which is where the problem stems from. The macro is also copying the 'Hide' formatting and I want to exclude that. This is the current macro I am using:
I need to insert blank row/s between the missing dates. Let me explain in detail,
I have a start date in Cell B1 and end date in Cell D1. Need a macro to verify the date range in Col B with these start & end dates and insert blank row for missing date corresponding to employee names in Col A. This should be repeat till last used row of the sheet.
I am trying to come up with a code that will copy column A entirely, and insert the copied cells into the first blank column. In the columns with information in them, there will always be text in the first cell, so that can be used as the test to find the first blank column, but I'm not sure how to get this done for my macro.
I need help writing a macro. I only have experience recording them, not writing them in VBA.
I need to check columns A and B for blanks. If A and B are both blank, I want the macro to delete the row and move on to check the next row. I need to perform this macro for the entire worksheet.