Removing Dashes Deletes Everything After First Dash

Mar 25, 2013

I have entries that look like this - 300-7188258-1

300-8983980-5

I need to remove the dashes. I find and replace all - with nothing. that has worked for YEARS. Seems simple to me.

Today, when I do it, Excel leaves the "300" and removes everything else. I even did a CLEAN function and it still does it.

View 3 Replies


ADVERTISEMENT

Removing Dash From Text Number String?

Oct 3, 2010

We often get spreadsheets from our customer that are formatted with both comma and dash combinations. We would like to only have the comma seperation.

Example:
R1, R2, R3-R5, R30

Result:
R1, R2, R3, R4, R5, R30

There is usually only one alpha character but sometimes more. Example: CR1, CR2, CR3-CR5.

The following macro works great if there are no alpha characters. how to solve the alpha/numeric combination?

Function Nums(rng As Range) As String
Dim adnum As Integer, n As Integer, num, Txt As String
num = Split(rng, ",")

[Code]....

View 9 Replies View Related

Remove All The Dashes

Jun 14, 2006

Have a column containing data which may have 1-3 dashes locates within
each cell value.
Such as:
125-457A
158-857-1116
124184A-1
125-8745-22D9
458-2145-002-7

Would like to remove all the dashes "unless" the last dash to the right
is followed by a just a single digit. The results would be as follows:

125457A
1588571116
124184A-1
125874522D9
4582145002-7

On the example data, it kept 2 of the dashes in the cell values,
because the were only one digit away from the extreme right, but
removed all others.

View 9 Replies View Related

Want To Add Dashes To Cell Text...

May 11, 2009

I have a column of city names, some are one word and others are two or more. I am trying to take the city name and add it to another word, add dashes in between them and make everything lower case. For example:

Column 1, Cell 1 is: San Diego

I'd like it to look like: books-san-diego (books being the keyword I'd like to insert before the city.)

View 3 Replies View Related

Return Cells That Have Exactly 3 Dashes

May 27, 2009

I have a column of data (column A) with cells that have IDs (alpha-numeric) that contain anywhere between 0 to 5 dashes. Since this column will change weekly, I want to dynamically pull only those cells that contain 3 dashes.

Example:
10648145-3026718-t526363536m
09wcg7-s1s89-wtpxm33-uu6jj0-9y8mv-v1
10658575-2349769-

I would only want to have returned 10648145-3026718-t526363536m since it contains 3 dashes. Do you know of a nifty formula for doing this? I think an array would get me the dynamic piece (so they are not spaced out).

View 3 Replies View Related

Look Up On Cell But Based On Value Between Dashes

Jul 6, 2007

Here is the examples of values i have

TCH1 - John Smith - I - REG - Total
AV - John Doe - D - REG - Total

what i want to do is lookup on the value after the first dash and before the second dash to get the names only ; John smith, john doe

View 9 Replies View Related

Remove Dashes In Number Automatically

Jan 13, 2008

I have a column of 1000 folio numbers and need a formula that will remove the dashes like so,

35-30-19-041-0180 into
3530190410180

View 4 Replies View Related

Date Entry Without Typing Dashes?

Feb 28, 2006

I want to type "121505" in a cell and it display 12-15-05. What formatting do I use?

View 4 Replies View Related

Format Cells With Dashes Between Alphanumerics

Nov 15, 2006

I'm trying to find a way to have excel 2003 format the data I put in a cell to auto insert dashes every five characters. I'm entering product keys for the software we have on hand, and it would be a little quicker if I could simply have excel auto format the data entered in to include dashes every five characters.

Example:
- I would enter: D5ATT3D28F6F44536489413E2 (This is a fake, non-working product key, I just typed in random numbers a letters.)

-Excel would format it like: D5ATT-3D28F-6F445-36489-413E2

View 9 Replies View Related

How Do I Get The Dashes To Not Count As A Digit/number?

Sep 12, 2007

I have this script that does what i need it to do but one thing, I need the script to count the numbers as digits only and not the dashes in the format.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Intersect(Target, Range("I21:I24")) Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Application.EnableEvents = False
If (Len(Target) > 11) Or (Len(Target) < 10) Then
MsgBox "Not a valid number of characters, please try again"
Target.Value = vbNullString...................

View 11 Replies View Related

How To Remove Specific Dashes Within Cell Leaving Others

Jul 28, 2014

I have a series of columns that have dashes in them and want to remove just specific dashes from the cell

Example of original 70489-344-15-001

This is what I want --> 70489-34415001

Got about 1000 of them ...

View 2 Replies View Related

Hyperlink Code For Sheet Names With Spaces Or Dashes

Sep 7, 2007

I believe I have 99% of what I need. The code below has one bug. (See just the underlined text for a very quick overview. The rest is detail.)

My goal is to generate a TOC that:
1) has the VBA run from my Personal Workbook.
2) can be run in any worksheet of any open workbook.
3) can be run in a worksheet of any name.
4) will insert itself at the currently active cell.
5) has entries hyperlinking to the referenced worksheets - of any name.

Right now, I'm stuck with the last point. The macro below will generate the TOC at the currently active cell. The TOC will be hyperlinks to the referenced worksheets.

However, if the referenced worksheet contains a space, dash, or other special character then the generated hyperlink is broken. For example, if the referenced worksheet is "sheet1" then the hyperlink generated works just fine. However, if the referenced worksheet is "sheet-1" then the generated hyperlink doesn't work.

Sub IndexList()
Dim objSheet As Object
Dim intRow As Integer
Dim strCol As Integer

Set objSheet = Excel.Sheets
intRow = ActiveCell.Row 'Start writing in active row
strCol = ActiveCell.Column 'Start writing in active column

For Each objSheet In ActiveWorkbook.Sheets
Cells(intRow, strCol).Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
objSheet.Name & "!A1", TextToDisplay:=objSheet.Name
intRow = intRow + 1
Next
End Sub

View 7 Replies View Related

Custom Number Format - Automatically Enter Dashes At Appropriate Spot

May 7, 2014

I am needing a custom format for the following. I need a cell entry to be 1 letter, three numbers, a dash, 5 numbers, a dash, two numbers, a dash, and then two number. Example: A109-54785-13-00. The first letter will almost always be an "A."

To further complicate the matter, the entry is copied from an email and pasted without the dashes. In the above example, the number in the email would read, "A109547851300." I copy it from the email and paste it in the proper cell in the worksheet. I would like the custom format to automatically enter the dashes at the appropriate spot.

If it was all numbers, this would be easy. I created a custom format for the numbers, but when the A is included, Excel no longer treats it as a number and the custom format did not work.

Is this possible in Excel (without VBA).

I could use the custom number format I created and then later go back and add the "A" at the beginning, but that is as much work as manually adding the dashes.

View 2 Replies View Related

Macro That Deletes Certain Results

Jun 30, 2008

I am making a macro that deletes #N/A's, but i want to add a few things to it
that should be deleted:

the phrases "total board", "total metal" and "Item", and any non-text (i.e. any
number) that appears.

this is what i have so far:

View 9 Replies View Related

Macro That Deletes Row Before And After Certain Phrase

Nov 3, 2008

I need a macro that searches my spreadsheet for a keyword in Column B. If it finds the keywords (or an array of keywords would be even better), it then deletes the entire row above the keyword, the row with the keyword, and the row below the keyword.

So for example,

(Column B)
1 - Row Above
2 - Keyword Row
3 - Row Below

If the macro finds the text in column 2, it would delete 1, 2 and 3.

I need to have a second macro that performs a very similar function.
it copies the 3 rows (similar to the example below) to a different sheet based on the keyword.

View 3 Replies View Related

Deletes A Row If It Finds A Specified Value In A Specified Column

Dec 23, 2009

deletes a row if it finds a specified value in a specified column (in this instance, "NB" in column E). However, it is very slow and some end users are complaining about the amount of time it takes to run. Here's what I'm using at the moment:

View 5 Replies View Related

VBA Code Which Deletes A Macro

Aug 11, 2006

I’ve got a macro that automatically starts when the workbook is open. The macro finishes with

Application.Dialogs(xlDialogSaveAs).Show

The document will be always saved with a new name. As I just need the macro once when the workbook is created I’m looking for a code that deletes the macro before the workbook is saved. I tried to record a macro while I was deleting another macro, but apparently it is not working (the recorded macro is empty).
Does anyone know if there exists a code to delete a macro?

View 5 Replies View Related

VBA Code That Deletes All Data Except For Highest Value

Mar 27, 2014

What each piece of this code means and what it is doing? The more details the better

[Code] .....

View 1 Replies View Related

Modify Macro That Deletes Rows

Aug 20, 2008

i have this macro made by another member here that looks for "T" in column 10 and deletes entire row if in that row has a "T". I need it modified to also delete if it contains "FT" and also erase if cells is blank.

Sub Macro8()
Sheets("FORMERS").Select
'deletes entire rows based on a text on one row (this case errases all that have a "T" in column 10 (column J)

Dim DeleteValue1 As String
Dim rng1 As Range
Dim calcmode1 As Long
With Application
calcmode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With...........................................

View 9 Replies View Related

File Unstable If It Gets To Big: Only Deletes The First Entry

Jun 28, 2006

The file that I am currently working on is getting really big. It is currently 101MB and we aren't done yet. In contains a lot of Macros and also a lot of ordinary excel formulas. I have recently noticed that excel sort of gets unstable with this file. For instance if I select a very large area eg A200:IK19000 and delete it, it only deletes the first entry (A200). What is going on? Is this a typical excel thing? What can I do to fix it or avoid it in the future?

View 2 Replies View Related

Speed Up Macro: Deletes All Duplicates

Jun 6, 2007

It takes all numbers in column 4 starting with Row 15 and deletes all duplicates. It then shows the number of times the number was duplicated and puts this number in column 3. MY PROBLEM: The macro searches each line and takes FOREVER! I have data with thousands of lines. I already tried the screenupdating method which really doesn't help that much. Is there possibly a better code for doing this?

Sub Factor()
Dim sID As String
Dim sOldID As String
Dim lLastRow As Long
Dim lrow As Long
Dim lcount As Long
Dim lLoop As Long
lLastRow = ActiveSheet. Cells(Rows.Count, 1).End(xlUp).Row
lrow = 15
sID = ActiveSheet.Cells(lrow, 4).Value
sOldID = "ActiveSheet.Cells(4, 15).Value"
lcount = 1
lLoop = 1
Do While Len(sID) <> 0
If sID <> sOldID Then
If lLoop = 1 Then.................................

View 5 Replies View Related

Parse After Each Dash

Aug 9, 2007

I work in the Oil and Gas industry and deal with large data tables that have "Location Codes" for lack of a better term.

The problem is that not all Databases use exactly the same format of code, they will however always have the following:

xx-xx-xx-xx ---> ie. a string of four numbers each seperated by a Dash.

This string sometimes will appear after a text name of varying length. With this in mind I would like to parse the four numbers into four different columns.

Things I've tried with some success:

Using the "Right" function to break off the location code off the end of the entire name, and then using the ".parse" command in VB to seperate the numbers at given intervals.

This is great for certain purposes however because the four numbers are not always 2 digits, and the ".parse" command cuts at given intervals it is hard to accurately parse an entire set of data.

Some examples of location Codes are given below:

9-23-78-11
WEST DOE 11-16-81-15
KNOPCIK 3-9-73-9

View 9 Replies View Related

Macro Stops Every Time It Deletes A Sheet

Oct 15, 2008

I have a macro that that stops every time I’m trying to delete the sheet. I get this message. “Data may exist in the sheet(s) selected for deletion. To permanently delete the data, prese Delete.” and I have to manually click “delete” to continue running the macro. How can I avoid this stop so that macro runs thru it without stops?

View 2 Replies View Related

Writing A Macro That Deletes Blank Rows

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

Macro That Deletes All Cells In Column D Of All Worksheets

May 22, 2007

I need a Macro that deletes all cells in column D of all worksheets in a book that are equal to the word "Timeout" and to shift the cells to the right of the "Timeout" cells into the deleted cells but leaving all other rows where the word "Timeout" is not present.

So in the case of Rows 2, 4, 6 and 8 containg the word "Timeout" in column D, I would like cells D2, D4, D6 and D8 deleted and the remaining cells shifted to the left but cells D1, D3, D5 and D7 left as they are.

Here is an example line of data:

16:02:30LEXKRunningprocedure:125sth
16:32:30LEXKRunningTimeoutprocedure:X125sth
17:20:54LSXPRunningprocedure:oxford
17:56:48LSXPRunningprocedure:xoxford
18:48:24LEXKRunningprocedure:125sth
19:18:24LEXKRunningTimeoutprocedure:X125sth

View 9 Replies View Related

Prevent Formula #REF! When VBA Macro Deletes Columns

Aug 5, 2009

I'm using the following code to delete columns:

Dim rng As Range
Dim i As Integer, counter As Integer

Set rng = Range("1:1")

i = 1

For counter = 1 To rng.Columns.Count

'If cell i in the range contains an "x",
'delete the column
If rng.Cells(i) = "x" Then
rng.Cells(i).EntireColumn.Delete
Else
i = i + 1
End If

Next

My problem is that I have cells in other worksheets linked to the worksheet that is running this macro and everytime I run it, I get a handful of "#REF" errors. I think this problem might be solved if I could simply delete the contents of the column rather than deleting the entire column. How can I modify my code to do this?

View 4 Replies View Related

Speed Up Macro Code That Deletes Rows

Sep 13, 2006

I am trying to parse and remove unwanted rows from a very large text file using At the moment, the application runs rather slow and was wondering if the experts could give some pointers on how to make the code more efficient while still keeping it simple so others may be able to modify later. I am keeping the ScreenUpdating True as the alternative false will just show Excel as Not Responding to the user until the VB is finished.

Sub deleteReplaceRows()
Application.ScreenUpdating = True
Dim DeletedRows As Integer
Dim lastRow As Long
Dim Arr(7)
Arr(1) = "<PUZZLE>"
Arr(2) = "<%"
Arr(3) = "%>"
Arr(4) = "Response."
Arr(5) = "</PUZZLE>"
Arr(6) = "<HINT>"
Arr(7) = "<MESSAGE>"

For i = 1 To 7
Do
Set rng = Columns(1).Find(Arr(i))
If rng Is Nothing Then Exit Do
rng.EntireRow.Delete
DeletedRows = DeletedRows + 1...................

View 2 Replies View Related

Loop Deletes Previous Entries From Array

Oct 17, 2006

I think the loop is deleting my previous entries and only putting the last results in.

For assortedrowindex = 3 To 400
targetdate = Date
Do While Month(targetdate) = Month(Date)
Redim Preserve arrTransactions(assortedrowindex - 2)
arrTransactions(assortedrowindex - 2).CUSIP = Cells(assortedrowindex, 12)
arrTransactions(assortedrowindex - 2).OrderDate = Cells(assortedrowindex, 9)
arrTransactions(assortedrowindex - 2).BuyCurncy = Cells(assortedrowindex, 2)
arrTransactions(assortedrowindex - 2).SelCuurncy = Cells(assortedrowindex, 4)
arrTransactions(assortedrowindex - 2).Fund = Cells(assortedrowindex, 7)
arrTransactions(assortedrowindex - 2).SettleDate = Cells(assortedrowindex, 10)
arrTransactions(assortedrowindex - 2).BuyUnits = Cells(assortedrowindex, 15)
arrTransactions(assortedrowindex - 2).FxRate = Cells(assortedrowindex, 16)
If targetdate < arrTransactions(assortedrowindex - 2).SettleDate Then
' Sheets("Sheet2").Activate...............................

View 4 Replies View Related

Extracting Data After A Dash

Nov 9, 2011

[URL]...

This entire link is in one cell i would like the data Iowa_Health_System

What formula can i use

View 2 Replies View Related

Can't Get Rid Of Dash In Blank Cells

Feb 12, 2014

I have a spreadsheet that shows a dash in some blank cells and I can't get rid of it. Cells are formatted as general, there's no event code, no conditional formatting, no data validation, no auto-formatting, no nothing. I can copy a cell from outside the range with no dash in it and paste it into one of the cells with the dash and the dash remains. I can't figure it out.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved