Can smbd help me to convert some values from real to virtual?

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

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

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.