If Cell Doesn't Start With Asterisk Delete Row
Sub DeleteRowsBasedOnCriteria()
'Assumes the list has a heading.
Dim cl As Range
For Each cl In Range("A6", Range("A65536").End(xlUp))
If cl.Value <> "=~*" Then
cl.EntireRow.Delete
End If
Next cl
End Sub
but it is deleting every row, I am not sure what is wrong?
starting in cell A6
if cell does not start with *, then
delete entire row,
next cell
that is the logic im seeing...ive tried a few o ther combinations like "~*" etc...
View Complete Thread with Replies
Sponsored Links:
Related Forum Messages:
Delete Entire Row If Cell In Column Starts With Asterisk
I'm using the following code to delete rows that I don't want to include and I've ran into some more things that need to be deleted... For lLoop = RngCol.Rows.Count To 2 Step -1 Select Case RngCol(lLoop, 1) Case " Date:", "Skill:", "Agent Name", "~*", "*Train*" RngCol(lLoop, 1).EntireRow.Delete End Select Next lLoop An example of "~*" would be: ***SICARII*** An example of "*Train*" would be: Ozgrid Train1 It's not recognizing these new cases. Do I have to utilize FIND? (since CTRL+F does work with the given cases)
View Replies!
View Related
Delete Row If Doesn't Contain Certain Numbers
Working at a company where we every month extract our customers into a excel document. This is the CRM system , and some of the clients can't (shouldn't) be approached. In Cell C is their customer classifications. In total there is about 60 different classifications. 10 of them is clients who we can send information to. For example customers with class 11111 or 41414 or 51515 or 61616 (among with 45 others) can't be approached. I'd like a macro/script who can delete all the nonrelevant clients so that afterwards I have a list of clients who can be approached.
View Replies!
View Related
Delete Rows Where Cell Doesn't Equal Adjacent Cell
I have a sheet in Excel 2004 for Mac that is a patient list with over 2000 patients. I need a rule that will compare values (patient IDs and responsible party ID) in two adjacent cells, if the values are different, to delete the entire row. The goal is to get rid of patients (rows) that are not the responsible party (responsible party ID).
View Replies!
View Related
Conditional Formatting For Row Banding Doesn't Work After Autofilter
For obvious reasons, the conditional formatting to shade alternate rows doesn't work when filtered. So I think I need another way of doing it. Luckily, my table is fairly static, rows aren't added or removed. The first column is excluded from the banding. As is the first and last row with data (1 & 67) respectively. I found a relevant thread here, but the code is beyond my understanding.
View Replies!
View Related
NAME Doesn't Stay Attached To The Cell
I have a cell (H27) which has a (sum) total in and have attached a NAME FRED. This is fine as long as the client doesn't add a row above it. If they do when I re-open the sheet the NAME doesn't stay attached to the cell (now H28) Is there a way to keep the NAME attached to the cell regardless where it is? Private Sub Workbook_SheetActivate(ByVal Sh As Object) Range("$H$27").Name = "Fred" End Sub
View Replies!
View Related
Cell That Doesn't Reach The Desired Amount
function that add to any cell that doesn't reach the disired amount. If the required number is 14 and a calculated cell comes up with 13 or less; I need a funtion to take that number and add a penalty number to it. For example: For arguements sake the penalty is $150.00. Suppose cell 1A has 5 and cell 1B has 5; cell 1C adds them for a total of 10. I need cell 1D to realize that the number in 1C did not equate to atleast 14 and therfore 1D should show $150.00 and for every cell selected that falls short of 14 should add an additional $150.00 to 1D.
View Replies!
View Related
Highlight A Cell Formula Result If It Doesn't Match
I've been asked to assist with modifications of an excel spreadsheet. One of the features is a column that has a formula of what the total order should be. For example, 1 base order of 25.00, plus 1 bonus order of 18.00, plus 2 bonus orders of 15.00 would be $73.00 due. Then data entry persons enter the actual amount collected. Is there a way to highlight either the cell or the result if the amount collected does not equal the amount due? I know I can accomplish this with another column, but they want to keep the columns to a minimum. This is for a non-profit agency and the orders are now at 1000 that must be entered within a day or two period, so they want to keep the fields to a minimum so as to make the entry easier for those doing the input. And they would like the data entry person to see an immediate flag if what he or she enters as collected does not equal what is due.
View Replies!
View Related
VBA - Delete Space (cell Start)
I often have to work in Excel-spreadsheets which provide values to me in a rather unpractical way. For some reason, every cell entry starts with a space, followed by the value. It makes it impossible to start calculating with the values right away. I tried replace: " " with: "" But that way all the spaces in the sheet are removed, not just the spaces at the start of each cell. I would like to avoid that, as it makes the descriptions a bit difficult to read... So, any ideas on how to write a little macro (or a tric in Excel itself) which I can use to quickly get rid of those spaces and start calculating?
View Replies!
View Related
Doesn't Work If The Worksheet Hasn't Been Saved Yet
I'm trying to simplify a formula that I'm using in a spreadsheet that's being used mostly in Excel 2000. 2 reasons I'm doing this: 1) It doesn't work if the worksheet hasn't been saved yet. 2) It's ugly =DATE(YEAR(DATEVALUE(MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,3) & " 20" & MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+5,2))),MONTH(DATEVALUE(MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,3) & " 20" & MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+5,2)))+1,0) The formula returns the last day of the month of the name of the sheet. For example, if the sheet is names "Mar 07", it returns 3/31/07. (yeah, when the 2100 issue becomes a big deal, I'm not going to be ready but I have 92 years to think about it) Even if I can't make it prettier, does anyone have a way to get the sheet name into a formula without VBA Code in a file that hasn't been saved.
View Replies!
View Related
Always Start In Certain Cell/row
I have a macros that copy’s certain bits of data forma row, then copies it to another sheet, however I always need it to start in column A. E.g. if my active cell is C3, I want to start in A3, likewise if the active cell is E3, I want to be able to start in A3.
View Replies!
View Related
Copy Between Worksheets Doesn't Work (look For A Certain Value In Worksheet A And Copy That Row Of Data To Worksheet B)
look for a certain value in worksheet A and copy that row of data to Worksheet B. However, it seems to be only copying the row in worksheet A and pasting it. Is there something that a noob VBA scripter has missed out? PHP Private Sub GetInfo_Click() Dim r As Long, LastRow As Long, Status As Integer Dim Message As String, Title As String, Default As String, MyValue As String Application.ScreenUpdating = False MyValue = Range("A4").Value Workbooks("invoice.xls").Worksheets("A").Activate LastRow = Range("C65536").End(xlUp).Row For r = LastRow To 1 Step -1 If Cells(r, 1).Value = MyValue Then Rows(r).EntireRow.Copy Workbooks("invoice.xls").Worksheets("B").Activate Rows("8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Status = 1 Workbooks("invoice.xls").Worksheets("A").Activate Rows(r).EntireRow.Delete Exit For End If Next r Application.ScreenUpdating = True
View Replies!
View Related
Using ' In Cells: Add A ' To The Start
I currently have a number of spreadsheets with number data in it. I need to import it into a third party program. Unfortunately when this program imports it it counts numbers such as 1 as 1.0. This third party program says the only way around this is to put a ' before the numbers and this seems to fix the problem. My problem is that I have so much data I cannot go through ever cell and add a ' to the start. IS there a quick way to add ' to the start of certain cells?
View Replies!
View Related
Copy 'x' Cell Value Evey Nth Cell Along On Same Row
Have often used this site, but now need an answer to something a little more specific. I would like to create a forumlae/function that would allow me to copy a cell value 'x' into every 'y' cell along. e.g copy cell x every 3rd cell along (in same row). The formulae must allow for 'y' to be of any value between 1-5 as this can change. I have attached a screenshot, as pictures are probably much better than my text above.
View Replies!
View Related
Hyperlink Doesn't Work
I have a hyperlink to [url] that doesn't work. When I click it I get an error saying "Unable to locate the server or proxy server". But when I cut & paste the address from the hyperlink into my browser (no chance of mistyping), it works fine.
View Replies!
View Related
Validation Drop Down Doesn't Appear
I named a range State, it contains a list of all the US state abbreviations. I do a data validation that refers to this range as a List. If I type in something that's not in the named range I get the error message I created for the Validation. But - I don't get a drop down button. I tried to do the same validation on another cell and get the same thing. Other drop downs for validation appear.
View Replies!
View Related
Right Click Doesn't Work
As said, the right click doesn't work anymore, last week it was working but it doesn't anymore. When I right-click wherever in the spreadsheet nothing happens but I know it's working because it works outside excel.
View Replies!
View Related
Listbox Doesn't Redraw
I have a worksheet with a listbox from the controls toolbox. I have to use the controls toolbox activex version because the box is formatted and I don't want a vertical scrollbar. I don't want to use a userform either because that would be major overkill. When the view is set to full screen the listbox partially disappears. Paging up and paging down will redraw the screen and the listbox. I've tried application.screenupdating with different listbox events but nothing works.
View Replies!
View Related
Some Times If I Do A =if( ) Formula It Doesn't Work
What am I doing wrong here. Some times if I do a =if( ) formula it doesn't work. For example, look at the attached picture. Cell K63 should say "End of Run". But it doesn't, What gives? Also I have had before where i do =IF(X62>$O$2,"End of Run", 0) (and $O$2 =81) and the cell when X62 is 81, not greater than. I know I can to >=, but thats not what I am doing.
View Replies!
View Related
Why Doesn't The Sound Play When The Value Changes Indirectly?
This is a complete mystery to me. I have some code (reproduced below) that plays a .wav file when any of the values in a1:a9 changes from 0 to greater than 0. This code works when I manually change one of the values to a trigger number in any of the cells. The problem is that the values in a1:a9 are really pointers to other cells. For example, a1 is "=sum(D9:D20)" So, when I d9:d20 chnages values such that a1 changes from 0 to 5, the sound doesn't play. To put it simply, if I type "5" in a1 the sound plays. If a1 = D1 and I type "5" in D1 the value in A1 changes to 5 but the sound doesn't play. How do I modify this code such that any change in the value of A1:A9, no matter the source of that data change, triggers the playing of the sound? ......
View Replies!
View Related
If Statement Doesn't Recognize Non-zero Values
I have the following formula with multiple if statements: IF(N2>0,N2,IF(O2>0,O2,IF(P2>0,P2,IF(Q2>0,Q2,IF(R2>0,R2,IF(S2>0,S2,IF(T2>0,T2))))))) This formula refers to cells in columns N,O,P,Q,R,S and T. Every cell in columns N,O,P,Q,R,S and T also contains formulas (VLOOKUPs). My if statement works fine but when it checks cells in column P, for some reason, it doesn’t recognize cells with non-zero values. I can’t figure out why this is happening and how to fix this problem.
View Replies!
View Related
Isolate Data That Doesn't Match
I have a long lists of values (product numbers) from our inventory records. Now, we've been given a new list of product numbers, some are the same and some are not. I want to isolate (spit out) the values from column A, than don't match column B. Column B is the list we SHOULD be using, column A is what we're currently using. See example below. Old Products New Products 34544 34544 34545 34546 34546 34547 34547 34548 34548 34550 34549 34551
View Replies!
View Related
Full Screen Doesn't Work.
This might be extremely easy, but why my Excel (nor Word for that matter) doesn't go to full screen anymore? I'm pretty sure that I haven't used any options, I do have a new graphics card, but all the other applications goes to full screen. I have restarted my computer. Basically I think that it's either some option, or then reinstalling Office.
View Replies!
View Related
VBA Doesn't Recognise Selection
I have a report that has been running in it's current state for several months with no issue. However, today it has decided that it doesn't understand the word 'selection'. eg: selection.copy gives compile error. Now... obviously NOT USING selection is preferred. However, let's put that aside for now because there are LOTS of these in this report and it's never had an issue until today. Is there some setting that could have gotten changed or something? It's happening on multiple computers and we're running Excel 2003 (standard) with SP3.
View Replies!
View Related
Counting Even If Doesn't Meet Criteria
I am trying to use this function to figure out averages for tests. there can be up to 25 tests in the sheet which is where the "YES" comes in. If the test booklet was used for this class then YES will be placed in the cell in field B2:B26. Now thes issue I'm having is that the formula is doing the math for the fields C2:C26 if there is a number in them if there is even if it does not say YES in the B2:B26 field. Here is the formula/function I'm using: =(COUNTA(C2:C26))/COUNTIF($B$2:$B$26,"YES")
View Replies!
View Related
Private Sub Workbook_Open() Doesn't Execute
why the code below might not execute ? It just seems like it skips over the code and doesn't run at all. Private Sub Workbook_Open() 'AssignRequestNumber() MsgBox ("Whoa") Run "AssignTrackNumber" End Sub I have a macro assigning a unique number to the file in a fixed cell whenever the .xlt file is opened from File-New.
View Replies!
View Related
Code Doesn't Loop Properly **
I have some code (probably a little inefficient, but still) that should delete any rows that contain nothing in column V. My problem is that it only deletes 1 row at a time: Dim c As Long Dim Limit As Long Limit = Cells(Rows.Count, 11).End(xlUp).Row For c = 2 To Limit If Cells(c, 22).Value = "" Then Cells(c, 22).EntireRow.Delete xlUp End If Next c
View Replies!
View Related
Programme Doesn't Work When Sent To A Different Computer
I have a programme which works fine on my computer at home but when I send it via email to work the 'sort' function messes up (there is a chance it could be the 'vlookup' function, though) and all the cells in the sort range lose their formula reference - which is of course a tad annoying. The part of the programme I'm having difficulty with is this: Range("SsNo1").Resize(d, f).Offset(a, 0).Select Selection.Sort Key1:=Range("FRSet1"), Order1:=xlDescending, Header:=xlGuess _ , OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal
View Replies!
View Related
Array Doesn't Seem To Write Out Results
I have 4000 rows of data with numbers in it (only one column...column C). These numbers are consecutive but these have breaks in between. So I am trying to find out where those breaks are and output those points in a list. So here is a macro that I came up with...but these array doesn't seem to write out results.... can anybody help please? This macro tries to compare the two adjacent cells and if the difference between the values is greater than 1 then it copies that value in an array and writes that value in a cell in the same sheet. Sub Macro1() Dim temp(1, 1000) As Integer i = 0 previouscell = 0 For Each cell In Range("C:C") currentcell = cell.Value abc = previouscell + 1 If currentcell <> abc Then temp(1, i) = currentcell i = i + 1 Range("D" & i).Value = temp(1, i) End If previouscell = cell.Value Next cell End Sub
View Replies!
View Related
Why Doesn't My Variant Array Work
The answer is probably "because I'm stupid", but I really can't get my head around it! I'm playing with variant arrays for the first (and possibly last) time, The code I have is: Sub test() Dim vSheetColours As Variant Dim iCounter As Integer vSheetColours = Range("Colours").Interior.ColorIndex For iCounter = 1 To UBound(vSheetColours, 1) MsgBox vSheetColours(iCounter, 1) Next iCounter End Sub (Obviously this code doesn't do anything useful - but if I could get it to work, I might have a chance of making my real code work!) Colours is a range of 8 cells. Each one has some text in, and has a different background colour. I'm trying to store the colours. If I run this code, I get a runtime error 13 type mismatch, and it highlights For iCounter = 1 To UBound(vSheetColours, 1) But if I replace vSheetColours = Range("Colours").Interior.ColorIndex with vSheetColours = Range("Colours").Value it works fine.
View Replies!
View Related
Right-click Menu Doesn't Exist
I have few questions, 1. why the "auto sum" icon grey out, and doesn't work. 2. when I right click the sheet, the menu doesn't show up. 3. Insert columns/rows, When I highlight 2 columns/rows, right-click the mouse & the menu doesn't show up for me to choose insert col/row.
View Replies!
View Related
Workbook_Open Doesn't Run On Second Open
I have noticed this on more than one workbook with an Workbook_Open macro. When you open Excel, open Workbook1, do some work , save or don't save and close, then reOpen Workbook1 without having closed the Excel application, the Workbook_Open macro in Workbook1 doesn't run. Closing Excel and reopening Workbook1 initiates the Workbook_Open macro. It's as if Excel remembers having previously opened Workbook1 and so it doesn't rerun the Workbook_Open macro the next time you open it.
View Replies!
View Related
Scroll Down/Across Worksheet Doesn't Move
I have two basic questions regarding the Excel program/UI I'm currently using Excel 2000, One annoying thing I find with this version is the way the screen doesn't follow along with my scrolling. ie: when I use the vertical scroll bar on the main window, it only updates once I release... not like a typical window which follows the movements of the scroll curser. Is this typical for later versions? I would update this program just for this feature alone! Also, a final question.... Does anyone know if there are any plans to update the handheld (pocket pc) version of Excel? The factory installed program is incredibly limited.
View Replies!
View Related
Create Worksheet If It Doesn't Exist
I need to create a worksheet and then populate it with header row containing columns names, and with values starting at row2. Before I do all this I wanted to first create a spreadsheet, I was successful in getting this done by getting a piece of code from this website. But, what if spreadsheet already exists from a previous run, then, in that case I want to clear the contents. Before I get too far ahead, I am unable to escape runtime error 9, array subscript out of range whenever I use any sort of code to check if the sheet exists. Also, my attempts to circumvent this error by putting in errorhandling is ignored, i.e. I get the standard run-time error message box, but, not what I want the code to do is such an error occurs. Function wsExists(wksName As String) As Boolean On Error Resume Next wsExists = CBool(Len(Worksheets(wksName).Name) > 0)End Function Private Sub Cmbsummary_Click() On Error Goto ErrHandler: 'Worksheets("MySheet").Activate Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = "MySheet" Exit Sub
View Replies!
View Related
Using 'IF' With Conditional Format (change Cell Color Based On The 'P' Or 'F')
My cell has a 'P' or an 'F' plus some additional text. I'm trying to change cell color based on the 'P' or 'F' but I can't get it to recognize the letters. Samples of what I've tried: =IF(LEFT(L23,1)=P) =IF(MID(L23,1,1)=P) etc. I can 'FIND' the 'P' or 'F' but there may be a P or F else where in the cell so the color may come up incorrect. I'm trying to get it to just look at the first character in the cell. Can the 'IF' be used with CFs?
View Replies!
View Related
Highlighting Active Cell's Row, Along With Any Row That Shares Same Value In That Column
Is it possible to click on a cell in column C, and have the wishlist below happen: That active cell's row is hightlighted. Any cell in that column that has the same value as active cell is also highlighted. Plus, any cell in another sheet that has that value it's row is highlighted too. Example: I click on C5 in Sheet 2 its value is 45000789 it row is highlighted, this value also appears in C3 in the same sheet, so it's row is highlighted as well. Plus, in sheet 1 in C10 this value appears and it's row is highlighted as well. When any of the values are clicked again the highlight is removed from all parties.
View Replies!
View Related
Pivot Table Field List Doesn't Appear
The field list does not appear when I create a pivot table in Excel 2007. It works properly if I start Excel in safe mode. I have toggled the field list button in the PivotTable Tools show/hide ribbon and I tried repairing Office 2007 from the control panel.
View Replies!
View Related
|