Macro to convert text to columns
-
Iam trying to create a macro to convert text to values. I have a workbook containing five sheets. In every sheet i have different no. of columns(ex: sheet1-20 columns, sheet2- 15columns etc) of data. i want to convert text(that was imported from Access) to values in columns. I just tried the below code. this is working for only one sheet. How would i apply this to multiple sheets. Sub text2columns() Dim src As Workbook Dim i As Integer Set src = Workbooks.Open("E: emp.xls") src.Sheets("Sheet1").Cells(1, 1).Select For i = 1 To 20 ActiveCell.EntireColumn.Select Selection.TextToColumns ActiveCell.Offset(0, 1).Select On Error Resume Next Next i End Sub Is it correct or is there a easy way instead of above. Please help me..
-
Answer:
Use a structure like this: Sub sample() Dim src As Worksheet Dim rng As Range For Each src In ThisWorkbook.Worksheets Set rng = src.Range("a1") Do Until rng.Formula = "" 'yada yada... Set rng = rng.Offset(0, 1) Loop Next src End Sub
Miningco.com Visit the source
Related Q & A:
- How to decrypt multiple columns?Best solution by Stack Overflow
- How to skip columns empty in CSV file when importing into MySQL table using LOAD DATA INFILE?Best solution by Stack Overflow
- How do you set just a general macro on your keyboard?Best solution by microsoft.com
- What is micro and macro?Best solution by Yahoo! Answers
- What is the difference between Economics MICRO and MACRO?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.