Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8994403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:25:28+00:00 2026-06-15T23:25:28+00:00

The following VBScript code giving me an error at the line .Range(.Cells(lRow, lCol), .Cells(lRow,

  • 0

The following VBScript code giving me an error at the line”

    .Range(.Cells(lRow, lCol), .Cells(lRow, lCol + 3)).Delete Shift:=xlToLeft

CORRECT

    .Range(.Cells(lRow, lCol), .Cells(lRow, lCol + 3)).Delete(-4159)

Error is: “Expected End of statement”.

CODE

  Sub DataShiftFromRightToLeft(Ob6)

   Dim lCol,COL_FIRST,startCol
   Dim NUM_TASKS:NUM_TASKS=36

COL_FIRST = objExcel1.Application.WorksheetFunction.Match("Parent Business Process ID", ob6.Rows(1), 0)
COL_FIRST=COL_FIRST+1

'Set wst = Ob6.ActiveSheet

With ob6.ActiveSheet

    For lRow = 2 To .UsedRange.Rows.Count
        lTask = 1
        Do While lTask <= NUM_TASKS
            lCol = COL_FIRST + (lTask - 1) * 4
            If Len(.Cells(lRow, lCol).Value) = 0 And _
               Len(.Cells(lRow, lCol + 1).Value) = 0 And _
               Len(.Cells(lRow, lCol + 2).Value) = 0 And _
               Len(.Cells(lRow, lCol + 3).Value) = 0 Then
                ' make sure there is something to the right to shift over
                If .Cells(lRow, lCol).End(xlToRight).Column < .Columns.Count Then
                    ' delete the empty cells and shift everything left``
                    .Range(.Cells(lRow, lCol), .Cells(lRow, lCol + 3)).Delete Shift:=xlToLeft
                Else
                    ' force the loop to the next row
                    lTask = NUM_TASKS + 1
                End If
            Else
                lTask = lTask + 1
            End If
        Loop
    Next lRow
End With

End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:25:29+00:00Added an answer on June 15, 2026 at 11:25 pm

    Your Shift:=xlToLeft is trying to use named parameters. This is not possible in VBScript. You have to define xlToLeft (Const) and to make sure that you pass xlToLeft at the correct position (use the VBA Docs to check the number and order of the arguments to .Delete).

    P.S.

    If you google for “vbscript delete xltoleft”, the first hit will help you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From VB.net we can execute VBScript code by using following line: System.Diagnostics.Process.start(AbsolutePathofVBScriptfile) But how
I've got the following code working as VBScript from command line: Set FRELoader =
i did the following vbscript code to write a text file called level.txt in
I have the following VBScript code: Dim returnVal returnVal = You did not pass
I am using the following VBScript code snippet to enumerate all files in my
I have the following vbscript code that returns the local IP address. It works
I'm using the following code snippet to determine what process ID my vbscript is
I am getting error message with the following code: Dim objPPT As PowerPoint.Application Dim
I'm trying to run the following VBScript code on a Win2k SP4: strComputer =
I am trying to run the following code in vbscript: ReturnCode = WshShell.Run(C:\Program Files\Virtutech\Simics

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.