excel add sheet vbs

teeheiman

New Member
Joined
Jul 17, 2006
Messages
6
Im useing the excel com application to create a excel file but when I create the sheets it doesnt come in order, is there any way I can add the sheet so that it adds it after and not before the deafult 3?
Code:
wrk.sheets.add()

Thanks,
Billy
 
Ya ive went in and tried to make the vba but im not really sure how I would set it to go on the correct cell that I wanted to put the boarder on.
Code:
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With

Thanks
 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
To debug vbscript compatible code, simply use late-binding with all object variables... This code will compile in VBA and VBScript except for the ThisWorkbook reference. You will need to use CreateObject or GetObject or the Shell...

Code:
Sub Example()
    Dim wrk As Object
    Dim sh As Object
    
    Set wrk = ThisWorkbook
    
    
    
    Set sh = wrk.Sheets.Add(, wrk.Sheets(wrk.Sheets.Count))
    
    With sh.Range("A1").Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With

End Sub
 
Upvote 0

Forum statistics

Threads
1,225,286
Messages
6,184,072
Members
453,210
Latest member
GravyG_123

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top