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)
Workbooks.Open Filename:= _
"S:CMU Trade VerificationTrade Discrepancy Report " & [shortmonth] & " " & [todaysdate] & ".xls"
Sheets("Daily Archive").Select
***Do this step when when range A2:N2 is not blank, otherwise, run the "Daily Data" macro first and then do the below steps.
View 9 Replies
ADVERTISEMENT
Jun 16, 2013
I am looking for a macro to put No in all Blank cells in used range of a sheet.
View 1 Replies
View Related
Mar 16, 2007
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?
View 2 Replies
View Related
Aug 16, 2014
i am looking for a Macro, that looks for a bank row and then copies the below row in to it.
For example
blank row 5
Paste data from row 6 to row 5
the sheet has 1500 lines of data with a lot of blank rows that needs pasting. I have attached a example of the file i am using.
View 3 Replies
View Related
Jul 11, 2007
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.
View 10 Replies
View Related
Feb 19, 2009
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?
View 9 Replies
View Related
Dec 15, 2009
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?
View 9 Replies
View Related
May 19, 2014
I Have the following macro conducting web queries. As the list of websites is spread out I need to get the macro to skip over blanks?
VB:
Sub Top5Investors()
'
' Top5investors Macro
'
'
Dim Erw, Frw, Lrw
Frw = 1
Lrw = Range("A" & Rows.Count).End(xlUp).Row
For Erw = Frw To Lrw
[Code]...
View 1 Replies
View Related
Jun 24, 2014
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.
View 1 Replies
View Related
Feb 12, 2014
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.
View 1 Replies
View Related
Oct 19, 2009
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.
View 9 Replies
View Related
Jan 23, 2010
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.
View 5 Replies
View Related
Nov 13, 2012
I would like VBA code to delete all rows where there are blanks in Col B
View 2 Replies
View Related
Jan 23, 2013
I've a file with lots of data. In that file I've some blank rows, I want a code which search complete blank row and delete.
View 2 Replies
View Related
Mar 28, 2014
I extract data from a database and export it to excel, the data has A-E Columns.
Then I run a macro to perform calculations based on columns A-E,
The macro results in creating columns F - K. I have specified to run the macro on columns F-K.
Now in the future I would want to increase my database and add in more columns for example F-Hand this would directly effect my macro.
Is there a way to specify in the macro to conduct calculations that is "F-K" after "A-H" that is as soon as you hit a blank column/cell?
View 1 Replies
View Related
Dec 13, 2007
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.
View 9 Replies
View Related
Mar 3, 2008
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 ...
View 9 Replies
View Related
Jun 12, 2008
I need a macro to delete blank rows from row 2, but excluding the last 4 rows where there is blank rows between the data
See example below where the rows containing blank cells after #2 in column A must not be deleted ...
View 9 Replies
View Related
Jan 10, 2009
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.
View 9 Replies
View Related
Nov 29, 2006
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".
View 3 Replies
View Related
Dec 19, 2006
The actual link from a list on the left side of that web page is "Printable List".
I can't work out why all other web pages work fine with;
Get External Data/Web Query, but this particular web page won't work.
Sub Test_A()
Sheets("test1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://acttab.com.au/interbet/racing?type=venues", Destination:= _
Range("A3"))
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With
End Sub
View 3 Replies
View Related
Aug 9, 2007
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
View 4 Replies
View Related
Jun 11, 2014
So I have two cells D15 and C15.
I simple want to copy there values (There paste links)
And paste them into the next blank row between D/E17/ and D/E26.
View 1 Replies
View Related
Mar 15, 2007
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.
View 12 Replies
View Related
Apr 3, 2014
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.
View 1 Replies
View Related
Apr 22, 2014
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:
[Code] .....
View 2 Replies
View Related
May 16, 2014
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.
Attached sample (Before&After) workbook.
Insert Missing Date.xlsx‎
View 4 Replies
View Related
Jul 6, 2008
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.
View 12 Replies
View Related
Nov 13, 2008
a vb macro which checks whether a cell is blank or not? if yes then r1c1 formula = now() if NO gives a pop up message you can not input the time here.
View 10 Replies
View Related
Dec 11, 2008
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.
View 8 Replies
View Related