another if-then question

  • Thread starter Thread starter bubba1965
  • Start date Start date
B

bubba1965

This may actually be a find-replace question. At any rate, I am not sur
how to formulate this.

What I am trying to do is check a specific column which contain
numbers and check to see if any numbers contain characters (that ar
not numbers) preceding the number. If a number DOES contain a characte
that is not a number preceding that number, then move that characte
behind the last character in another column.

For example, I want to check all the numbers in column D, if a numbe
in that column contains any character that is not a number - such a
*86, then the asterisk would be moved to column C - directly behind th
last character in that column.

So Column C reads Augustana, Column D reads *75
Afterward, Column C should read Augustana* and column D should read 75

Is this possible
 
Hi
try the following macro
Public Sub Change_D()

Dim R As Long
Dim C As Range
Dim Rng As Range
Dim left_val
Set Rng = ActiveSheet.UsedRange.Rows

For R = 1 To Rng.Rows.Count
left_val = Left(Cells(R, "D").Value, 1)
If Not IsNumeric(left_val) And left_val <> "" Then
Cells(R, "C").Value = Cells(R, "C").Value & left_val
Cells(R, "D").Value = CDbl(Mid(Cells(R, "D"), 2, 15))
End If
Next R
End Sub
 
Thanks Frank.
I got it to work.
I understand what I was doing wrong. Thanks so much for your help.
really appreciate it
 
Back
Top