Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-08-2012, 09:47 PM
gsrikanth gsrikanth is offline convert to number Windows XP convert to number Office XP
Competent Performer
convert to number
 
Join Date: Dec 2011
Posts: 133
gsrikanth is on a distinguished road
Default 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?


Reply With Quote
  #2  
Old 01-09-2012, 01:01 AM
Catalin.B Catalin.B is offline convert to number Windows Vista convert to number Office 2010 32bit
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

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
Reply With Quote
Reply



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 to number Convert PDF to PPT? Hinmini PowerPoint 1 10-28-2011 07:38 PM
convert to number How to convert PDF to jpg? gonner Outlook 1 10-28-2011 06:25 PM
convert to number 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

Other Forums: Access Forums

All times are GMT -7. The time now is 09:38 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft