Sleeper: Macro for Segregation of Text & Numer from range
Hi all
i m veryt new & trying to write my first VBA macro wherin user provides first range in which data is there which is segregated in to text & numerical column both text & numerical column is also provided by user, i tried foll code but it doesnot work.
pls help me
Code:
Sub TxtNum()
Dim i As Long
Dim j As Long
Dim n As Long
Dim LastRow As Long
Dim r1 As Range
Dim r2 As Range
Dim r3 As Range
Set r1 = Application.InputBox("Select the target range with the mouse", Type:=8)
Set r2 = Application.InputBox("Select the target range with the mouse", Type:=8)
Set r3 = Application.InputBox("Select the target range with the mouse", Type:=8)
LastRow = Cells(Rows.Count, "r1").End(xlUp).Row
For i = 1 To LastRow
If IsNumeric(Range("A" & i).Value) Then
With Range.Select.r2
.Value = Range("A" & i).Text
.NumberFormat = Range("A" & i).NumberFormat
End With
Else
With Range.Select.r3
.Value = Range("A" & i).Text
.NumberFormat = Range("A" & i).NumberFormat
End With
End If
Next i
End Sub
:dunno