#1
|
|||
|
|||
convert to number
an another question
i have in excel worksheet naming Page1, Page2, etc., in view code vba it is in the order Page1 then it come Page10 Page11 after Page 19 there come Page 2 Page 20 Page 21 I have problem with it while merging worksheet i want come in order Page1 Page2 Page3 how to sort this it take 1 10 100 2 20 200 general in sql we have convert to number we have the formula to_number(Page XXX, 99999) the it will come in order how in excel worksheets? |
#2
|
|||
|
|||
Use this code to sort the active workbook:
Code:
Sub Sort_Active_Book() Dim i As Integer Dim j As Integer Dim iAnswer As VbMsgBoxResult ' ' Prompt the user as which direction they wish to ' sort the worksheets. ' iAnswer = MsgBox("Sort Sheets in Ascending Order?" & Chr(10) _ & "Clicking No will sort in Descending Order", _ vbYesNoCancel + vbQuestion + vbDefaultButton1, "Sort Worksheets") For i = 1 To Sheets.Count For j = 1 To Sheets.Count - 1 ' ' If the answer is Yes, then sort in ascending order. ' If iAnswer = vbYes Then If UCase$(Sheets(j).Name) > UCase$(Sheets(j + 1).Name) Then Sheets(j).Move After:=Sheets(j + 1) End If ' ' If the answer is No, then sort in descending order. ' ElseIf iAnswer = vbNo Then If UCase$(Sheets(j).Name) < UCase$(Sheets(j + 1).Name) Then Sheets(j).Move After:=Sheets(j + 1) End If End If Next j Next i End Sub |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How do you convert to .MOV? | pmr8888 | PowerPoint | 0 | 11-30-2011 04:32 PM |
Convert PDF to PPT? | Hinmini | PowerPoint | 1 | 10-28-2011 07:38 PM |
How to convert PDF to jpg? | gonner | Outlook | 1 | 10-28-2011 06:25 PM |
Mailing: how to make the "page number" in Word is the same as "row number" in excel w | Jamal NUMAN | Word | 1 | 09-03-2011 11:37 AM |
Convert Number to Text | devcon | Word | 0 | 07-10-2010 01:16 AM |