Hello,

I am in need of deleting a certain range (known) in an EXCEL spreadsheet
and shifting over to the left once the range has been deleted. The below
code is provided by excel, I however cannot seem to make it work on WSH
(VBSCRIPT). Can anyone help.

Range("B1:B22").Select
Selection.Delete Shift:=xlToLeft

Thank you

Re: Excel Range Deletion and shift left by Miyahn

Miyahn
Mon Jun 21 22:11:43 CDT 2004

"AlexH" wrote in message news:utvc748VEHA.208@TK2MSFTNGP10.phx.gbl
> I am in need of deleting a certain range (known) in an EXCEL spreadsheet
> and shifting over to the left once the range has been deleted. The below
> code is provided by excel, I however cannot seem to make it work on WSH
> (VBSCRIPT). Can anyone help.
>
> Range("B1:B22").Select
> Selection.Delete Shift:=xlToLeft

Hi,
If you want to use the constant defined in Excel, use *.wsf file
including reference to the type-library of Excel.
For example, 'ConstantTest.wsf"

<job>
<reference object="Excel.Sheet"/>
<Script language="VBS">
Set xlApp = CreateObject("Excel.Application")
With xlApp
.Visible = True
.Workbooks.Add
.ActiveSheet.Range("A1:C3") = "abc"
MsgBox "Delete A1:B2 and shift to left"
.ActiveSheet.Range("A1:B2").Delete xlToLeft
End With
Set xlApp = Nothing
</script>
</job>

# AFAIK , you can't use the named parameter.

--
Miyahn (Masataka Miyashita) JPN
Microsoft MVP (Office Systems - Excel)
HQF03250@nifty.ne.jp


Re: Excel Range Deletion and shift left by AlexH

AlexH
Tue Jun 22 11:28:23 CDT 2004

I will try that. Thank you very much.



"Miyahn" <HQF03250@nifty.ne.jp> wrote in message
news:#DYfaYAWEHA.1144@TK2MSFTNGP10.phx.gbl...
> "AlexH" wrote in message news:utvc748VEHA.208@TK2MSFTNGP10.phx.gbl
> > I am in need of deleting a certain range (known) in an EXCEL
spreadsheet
> > and shifting over to the left once the range has been deleted. The
below
> > code is provided by excel, I however cannot seem to make it work on WSH
> > (VBSCRIPT). Can anyone help.
> >
> > Range("B1:B22").Select
> > Selection.Delete Shift:=xlToLeft
>
> Hi,
> If you want to use the constant defined in Excel, use *.wsf file
> including reference to the type-library of Excel.
> For example, 'ConstantTest.wsf"
>
> <job>
> <reference object="Excel.Sheet"/>
> <Script language="VBS">
> Set xlApp = CreateObject("Excel.Application")
> With xlApp
> .Visible = True
> .Workbooks.Add
> .ActiveSheet.Range("A1:C3") = "abc"
> MsgBox "Delete A1:B2 and shift to left"
> .ActiveSheet.Range("A1:B2").Delete xlToLeft
> End With
> Set xlApp = Nothing
> </script>
> </job>
>
> # AFAIK , you can't use the named parameter.
>
> --
> Miyahn (Masataka Miyashita) JPN
> Microsoft MVP (Office Systems - Excel)
> HQF03250@nifty.ne.jp
>