Highlighting/Deleting Special Charahters In A Range
Aug 15, 2008
I have a column that needs to be text format, but it needs to include only digits (0-9), no letters, no special characters. Also all cells need to have 7 digits.
I am trying to do a couple of things:
1 : Hightlight the cells that contain Strings with Non-Digits characters
2 : Highlight the cells with less than 7 characters (I have the code, it is below)
I have tried many ways to get #1 but I am stuck.
Help please.
This highlights the cells with less than 7 characters:
Sub StringLength3() ' IT WORKS!
Dim strTest As String
Dim i As Integer
Dim Cell As Range
'Select Range
Worksheets("tres").Activate
Worksheets("tres").Range("A2", Range("a65536").End(xlUp)).Name = "RangeA"
Range("RangeA").Select
For Each Rangea In Selection
i = Len(Rangea)
If i 7 Then
Rangea.Cells.Interior.ColorIndex = 7
End If
Next Rangea
End Sub
View 9 Replies
ADVERTISEMENT
Dec 12, 2011
I have conditional formatting set to hilight duplicates, but I a, wonder if there is a way to exclude special characters (in this case specifically dashes).
View 5 Replies
View Related
May 16, 2009
I have Column A with 380 cells filled in with numbers (A1-A380) i.e. numbers like..456758, 567848 etc etc
Column B has a subset of those numbers, maybe 80-90 or so (B1-B90).
What I want to do is either highlight the numbers in Column A that also appear in Column B in yellow, OR delete them from Column A altogether
View 8 Replies
View Related
Apr 17, 2014
I have a spreadsheet with thousands rows of items on. I am trying to identify duplicate entries based on two or three cells within each row. If those two or three cells are duplicated for that particular ID then the duplicate entry (row) should be highlighted for deletion.
Better still it would be great if there was a macro or formula which would delete that duplicate row.
So for example on the spreadsheet I have attached, I would like rows 6 and 9 deleted or highlighted as the criteria for deletion is a duplication of the entry in the 'YEAR' column AND the 'VALUE' column for the REFERENCEs AB-1234 and AB-9876 which are the unique identifiers for each individual case.
This would leave the end result as per the table below on the attached spreadsheet.
View 4 Replies
View Related
Feb 15, 2013
I found this spreadsheet on here and I have been trying to customize it to what I need. I am trying to have scores from skins match highlighted. I want only the minimum score to be highlighted but if there is another duplicate minimum score I don't want it to highlight anything. I also need to find a way to count the skins won by each player and have it off to the side.
For those not familiar with golf a Skin is a game where you try to get the lowest amount of strokes on a specific hole. Ex- 4 people play the hole one. P1 scores 4, P2 gets a 3, P3 and P4 get 6. The skin would go to P2 who has the lowest score on that hole.
Highlight lowest number in each column not highlighting if there are duplicates starting at L6 down to L11 and for each column till AC. And the same for the group just to the right on attached file.
On row 13 and 14 it tells me who won a skin. I want to tally up the total skins won by each player. so if Joe's names shows up twice on R14 I want it to tell me somewhere in the sheet Joe = 2
View 6 Replies
View Related
Jun 9, 2006
What is the line of code in VBA that allows me to highlight a range of cells (in a column) to the end of the range? e.g. Selection is A2, highlight to end of range in column A. I know this is simple, but I'm new to VBA. Unsuccessful searching the posts.
View 2 Replies
View Related
Jan 19, 2008
I have a worksheet 200+ rows with 7 columns (euro lottery numbers) I had great help last night to highlight any matching numbers. I'm getting lazy now, can anyone help with a formula to highlight a cell in an adjacent column when 2 or more numbers in the corresponding cells match the winning numbers, I know all I have to do is look down the columns and check but if a simple formula could be inserted it would save me perhaps missing something.
View 14 Replies
View Related
Mar 14, 2014
I have a file in which I have data from A9:I50.
In the column C i have the type mentioned either MTC or SELF.
If the value in column C is SELF then I want to highlight the corresponding rows from A:I.
[Code] ......
This code is colouring the entire row.
I want it to be highlighted from A to I.
View 2 Replies
View Related
Oct 28, 2013
How can I find prime numbers in a range and highlight it if a number in a cell is a prime.
View 9 Replies
View Related
Feb 2, 2013
I am using this Formula =Sum(Offset(A1,,,D1)) where I put for example number 4 in D1 and I get the sum starting cell A1 till Cell A4
I want the range to be highlighted as well, but I don't know how to do it.
View 1 Replies
View Related
Dec 29, 2007
I'm not to familiar with macros or VBA so I hope someone can help me out with this.
I have 2 worksheets in this workbook. I want to select the range A2:K3 (or better yet, the first 2 data rows); the first row 1 contains column headers.
Then copy those two rows.
Next, select everything else in the worksheet and then Paste Special>Formats
Then select cell A1 (just to give the active cell a place to rest) and then do the same to the second worksheet.
Then save the workbook.
My code below is pretty much a recorded macro. I'm basically wanting to change this macro to be expandable as the worksheet grows.
View 14 Replies
View Related
Aug 9, 2009
I created a macro that copies a range from one worksheet to another as shown below, which correctly copies everything including formulas.
View 9 Replies
View Related
Mar 20, 2008
I am aware that special characters such as -,(,),[,] are not permitted in named ranges (for lists), but is there a workaround for this? I have a lot of dependent lists that need to access names that contain either a - or () or both. I could simply remove the -'s or ()'s using find/replace, but they are required, as they're part of the name. I am aware of this method http://www.contextures.com/xlDataVal02.html#Illegal but I have a lot of dependent lists across a sheet, and a VLOOKUP isn't going to work. If there isn't a workaround, are there any allowed characters I could use to replace the -'s and ()'s?
View 3 Replies
View Related
Jan 29, 2014
This script is resulting in:
Run-time error '1004'
PasteSpecial method of Range class failed.
[Code] .....
It highlights
[Select Code] .....
when I hit debug.
View 2 Replies
View Related
Aug 29, 2008
I'm trying to find a macro that will copy data from the areas of B120:E179 and I120:K179 for example (linked to another worksheet within the workbook) and special paste (Values Only and skipping blank cells) it to the next available open cell up top where basic data entry will be taking place B10:E29 and I10:K29. I need it to only copy/paste the rows with data (skipping all cells/rows with no data) and once it is finished coping I will need it to place an "X" in column M next to the row that it copied data from. I would also need it to reference the data in each row from B to E and if there is an entry say on B14 to E14 that matches it but if I10 to E29 are blank then paste that information on row 14. If it does not match or if those columns are full then paste on next available line.
I hope I'm making sense here. This is for a vehicle tracking log between checkpoints. Each driver and info will be listed on each row. Columns B through E will contain information for each driver: name, badge, #passengers, and vehicle #. The log lists location, time, and destination for outgoing travelers in columns F to H. Incoming info is listed on Columns I to K............
View 4 Replies
View Related
Feb 17, 2010
Say i have a range A1:B3 and i define it as "Fruit", but then later decide i want to call it "food", or even just revert back to cell numbers. How would one go about doing this?
View 5 Replies
View Related
Aug 24, 2007
I'm trying to remove gif, jpg, and xls objects from a specific range and I can't seem to figure out how to do it. I can remove all objects from the sheet or only the gif and jpg files from a range. Here is the code I've been playing with:
Sub Clear_Sigs()
Dim Sh As Shape
With Worksheets("Sheet1")
For Each Sh In .Shapes
If Not Application.Intersect(Sh.TopLeftCell, .Range("A26:E32")) Is Nothing Then
If Sh.Type = msoPicture Then Sh.Delete
End If
Next Sh
End With
End Sub
I know this code says to delete only pictures and I've tried tweeking it to do all objects but it doesn't work for just the range I want. Any help is appreciated.
Thanks,
Amy
View 9 Replies
View Related
Jun 12, 2009
I need to have my macro select a certain range of cells with a specific product code and delete them. What would be the code for it (product code 107). Here is what i have so far:
Workbooks.Open Filename:=fNameAndPath, UpdateLinks:=1
ActiveWorkbook.Save
ActiveWorkbook.SaveAs Filename:=myStrPath1 & myStrPath2 & myFile3 & myExt, FileFormat:=xlNormal, CreateBackup:=False
Windows(myFile3).Activate
Cells.Select.Range ("A78:K153")
Selection.Delete
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Range("A1").Select
ActiveWorkbook.Save
ActiveWorkbook.SaveAs Filename:=myStrPath1 & myStrPath4 & myFile4 & myExt2, FileFormat:=xlCSV, CreateBackup:=False
View 9 Replies
View Related
Jun 11, 2014
I have a sheet with thousands of rows and 45 columns and I need to delete a range of cells (G:Y) if the cell in column V = the cell in column X, and I need to do this by row. I think an if/then statement would work.
View 4 Replies
View Related
Mar 22, 2013
I have the following problem within Excel. I have a dataset which contains duplicate values within a column(lets say A). I need to delete these duplicates in column A for a range of rows, where the range of the rows is based on column B. So for a given value in column B, lets say 5 which is 6 rows long all beneath each other, I need to delete the duplicates in column A.
A B
1 2234
4 2234
5 2234
4 2234
2 2234
3 2234
5 2234
5 2657
8 2657
9 2657
10 2657
8 2657
9 2657
2 2657
So above the red numbers need to be removed, automatically, since we have about 8000 rows in our dataset.
View 7 Replies
View Related
Oct 2, 2011
How can i delete a range of cell in another worksheet 2? for example, i have a data in B1:F1 in sheet 2 and i want to put a button in sheet 1 which will delete the data in B1:F1 in sheet 2.
View 1 Replies
View Related
Oct 2, 2012
Any easy way of finding out if deleting a particular sheet / range or selection will mess up any references elsewhere in the workbook?
View 1 Replies
View Related
Nov 13, 2013
I'm pretty new to coding from scratch in VB, and I've got some code that should loop, but it doesn't. The idea eventually will be to download a spreadsheet, make a new sheet for every item in a range, and then filter for each of those items and put it in the right sheet. I have to code to create the sheets (lightly modified from something I got here)
Sub CreateSheets()
'Written by Barrie Davidson
For Each c In Sheets("FilterList").Range("b2:b74")
Sheets.Add
ActiveSheet.Name = Right(c.Value, 30)
Next c
End Sub
That's working well, so I've tried to modify it so that it will also delete sheets based on the same range. I've gotten it to delete the first item in the range, but then it stops.
For Each c In Sheets("FilterList").Range("b2:b74")
Application.DisplayAlerts = False
Worksheets(c.Value).Delete
ActiveSheet.Name = Right(c.Value, 30)
Next c
End Sub
By the way, I don't know what the ActiveSheet.Name = Right(c.Value, 30) line does, but I put it in since it was in the code I was modifying.
View 9 Replies
View Related
Jul 20, 2009
On the attached sheet I am trying to indicate that enough data has been entered by highlighting the entire column. Any 3 cells in Rows 7-13 and 18-36 will be filled in with any of the values from cells O6-O11 (hidden). When the total = 6 i would like to highlight the entire column to indicate it has been completed.
The aim is two fold: to ensure that the correct number of points is allocated in each race, and secondly to indicate which column is the next to be filled in (as human error sometimes misses the column and adds the points to either the previous or next columns). You could call it idiot proofing the sheet. At present i have the cells in Row 37 conditional formatted to show this, but would much prefer the entire column to highlight.
View 2 Replies
View Related
Aug 1, 2013
I am attempting to make a range of cells' data be deleted if a cell outside of that range that had a name in it is no longer there. So if I have a list of names in cells A1:A6 and a range of data in cells D10:E20 that corresponds to a name in cell A2. If the name in A2 is deleted I would want the data in D10:E20 to be deleted.
View 9 Replies
View Related
Jan 29, 2014
I want to create a macro that will find a text string called "Season Average" in the entire workbook and delete a range of cells above it 4 cells longs starting right above the text and then going left.
Example is if "Season Average" is in cell D11, than I want the cells D10, C10, B10 & A10 Deleted and the cells to shift up
This happens throughout the entire workbook and multiple times on each work sheet in different spots not consistently same cells.
View 9 Replies
View Related
Jun 2, 2014
I have a target range for a worksheet change. Then when finished I highlight the data and press 'delete' I get an error within the code.
View 2 Replies
View Related
Sep 8, 2006
I have users that submit a workbook quarterly. Many of the submissions contain name ranges that I need to remove. I wrote the below to delete the named ranges but encounter an error when the macro encounters a named range with the Kanji (Japanese) character set. How can I update this to delete these ranges as well?
Sub DeleteNamedRanges()
Dim ws As Worksheet
Dim NR As Name
On Error Goto ErrTrap
For Each ws In ActiveWorkbook.Worksheets
ws.Activate
For Each NR In ActiveWorkbook.Names
NR.Delete
Next
Next
ErrTrap:
If Err.Number = "1004" Then
Resume Next
End If
End Sub
View 9 Replies
View Related
Feb 24, 2014
I'm trying to use the code below to copy active sheet into a new workbook and clean some parts of it so it will be ready for next department's data input work. But when it comes to deleting empty rows in it, code gives Run-time error "1004" : Delete method of Range class failed error and it marks the part "Rows(r).Delete"
[Code] .....
View 8 Replies
View Related
Apr 6, 2013
I have created a spreadsheet some time ago and have been asked to improve on it but I'm rusty with VBA.
I have an automated ordering system that saves each sent order as the date e.g "05-04-2013.xls" but the management team want a graph with the data for the last 4 weeks compared. I have created a seperate workbook called "consumables report.xls" which has a column with the products listed followed by columns "Quantity" and "cost" which is repeated for the 4 weeks of the month.
I want to add a button to prompt the user to choose the saved order e.g "05-04-2013.xls" (all orders saved in same directory) to copy and paste the quantity and cost columns (c8,D69) into "consumables report.xls". I got this to work earlier but it would only paste the formulas and not the values. So I need
A prompt to open workbook
Copy range (c8,d69)
Close work sheet
Paste special .value (c8,D69)
I dont care if it has to open the workbook to copy the data as this will only be used once a month so it dosnt matter how slow the code is.
week 1 week 2 week 3 week 4
Product
quantity
cost
quantity
cost
cost
quantity
cost
1
2
3
4
5
6
7
8
View 7 Replies
View Related