![]() |
Using "Equiv" excel fonction in vba
Hi,
My goal is to convert to a text a specific column which contain title "SSN". If the column "A" is SSN column, I could use: Columns("A:A").TextToColumns Destination:=Range("A1") works if the column "A" is SSN. Since, I don't know what is the column, I would like to say: 1- What is the column which contain "SSN" title on line 2 (like Application.Equiv("SSN",Range(A2:IV2),False) 2- Convert this column number in text (Example: convert column "4" to "D" 3- After that, I could use fonction Columns("D:D").TextToColumns Destination:=Range("D1") with D variable. If somebody have a simpler solution, plz, let me know :) Thank you, - Alex St-Pierre |
Using "Equiv" excel fonction in vba
Text to columns takes arguments and I don't know what they would be as I
don't know your data. That being said you should be able to fill that part in... Try this code... Sub ConvertToColumns() Dim rng As Range Dim wks As Worksheet Set wks = ActiveSheet Set rng = wks.Rows(2).Find(What:="SSN") If Not rng Is Nothing Then rng.EntireColumn.TextToColumns Cells(1, rng.Column), ???, ??? End If End Sub -- HTH... Jim Thomlinson "Alex St-Pierre" wrote: Hi, My goal is to convert to a text a specific column which contain title "SSN". If the column "A" is SSN column, I could use: Columns("A:A").TextToColumns Destination:=Range("A1") works if the column "A" is SSN. Since, I don't know what is the column, I would like to say: 1- What is the column which contain "SSN" title on line 2 (like Application.Equiv("SSN",Range(A2:IV2),False) 2- Convert this column number in text (Example: convert column "4" to "D" 3- After that, I could use fonction Columns("D:D").TextToColumns Destination:=Range("D1") with D variable. If somebody have a simpler solution, plz, let me know :) Thank you, - Alex St-Pierre |
All times are GMT +1. The time now is 05:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com