VBA if cell contain text

Sparda142

Board Regular
Joined
Dec 19, 2018
Messages
52
Hello,

I'm trying to create a VBA that states if within Column A if there is a text then paste to the right. If the cell in column A has a numeric value then do nothing.


ab
1john
21
33
4jake
5bill
67

<tbody>
</tbody>
 
@Rick Rothstein

My pleasure. I have "stolen" so many of your routines, it's the least I could do.

igold
 
Upvote 0

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Whilst my sample data and setup below may not be possible for this OP, I would point out some possible pitfalls of all the suggestions so far.
In the sheet below, column A is formatted as Text & other columns before running the codes were General.
Whilst all of the column A values can be identified as Text (given the column was formatted that way) the codes from posts 6, 7 & 8 all failed to transfer some of the text values. Further, two of the codes correctly identified the last value as a text value but have transformed it into a numerical (date) value in transferring it to the result column.

This modification of Rick's code seems to work for those values at least.

Code:
Sub Copy_Text_Only()
  Dim Lastrow As Long
  
  Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
  Application.ScreenUpdating = False
  Range("A1:A" & Lastrow).Copy Range("B1")
  On Error Resume Next
  Columns("B").SpecialCells(xlConstants, xlNumbers).Clear
  On Error GoTo 0
  Application.ScreenUpdating = True
End Sub


Excel 2016
ABCDE
11E21E2
2$45$$$45$$$45$$
3($5,55,,5.5,,,5,,E55$)($5,55,,5.5,,,5,,E55$)($5,55,,5.5,,,5,,E55$)
4DEC11-Dec1-DecDEC1
5
6Post 6Post 7Post 8Post 11
Copy Text Values
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,784
Messages
6,121,539
Members
449,038
Latest member
Guest1337

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top