VBA Check if a column is TAB delimited

decadence

Well-known Member
Joined
Oct 9, 2015
Messages
525
Office Version
  1. 365
  2. 2016
  3. 2013
  4. 2010
  5. 2007
Platform
  1. Windows
Hi, Is it possible to check if a column of data is TAB delimited, can someone help with this please
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
1. Select the column & do Text to Columns with a Tab delimiter (& undo if required), or
2. =COUNTIF(L:L,"*"&CHAR(9)&"*") Tells you how many cells in the column contain at least 1 tab character.

Is that what you wanted?
 
Last edited:
Upvote 0
Hi Peter, I am trying to do an if statement whether the data in Column A contains them or not as I will be adding code to determine what to do next
 
Upvote 0
Hi Peter, I am trying to do an if statement whether the data in Column A contains them or not as I will be adding code to determine what to do next
Sorry, I missed in your thread title that it was a VBA question. :oops:
I'm signing off for the night now but I'll have a look to see if it has been resolved next time I'm on the forum.

Edit: BTW, exactly what do you mean by "column A contains them"?
- Every populated cell in column A contains at least 1 tab
- Every populated cell in column A contains the same number of tabs
- At least one cell in column A contains at least 1 tab
 
Last edited:
Upvote 0
Try this

If you want to check cell by cell which one has Tab:

Code:
Sub test()
  Dim c As Range
  For Each c In Range("A2", Range("A" & Rows.Count).End(xlUp))
    If InStr(1, c, vbTab) Then
      MsgBox "The cell contains tab delimited:" & c.Address
      'here your code
    End If
  Next
End Sub


If you want to find the first Tab:

Code:
Sub test2()
  Dim c As Range
  Set c = Range("A:A").Find(vbTab, , xlValues, xlPart)
  If Not c Is Nothing Then
    MsgBox "The cell contains tab delimited:" & c.Address
    'here your code
  End If
End Sub
 
Upvote 0
Thank you DanteAmor, this is exactly what I was looking for
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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