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

  • SEARCH
  • Home
  • 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 8170347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:06:47+00:00 2026-06-06T21:06:47+00:00

Sub RowRangeMove() Sheets.Add().Name = CopySheet With Sheets(BigDataSet – Copy) .Range(A65000, .Range(A13000).End(xlUp)).Copy Destination:=Range(A1) With Sheets(BigDataSet

  • 0
Sub RowRangeMove()
    Sheets.Add().Name = "CopySheet"
    With Sheets("BigDataSet - Copy")
        .Range("A65000", .Range("A13000").End(xlUp)).Copy Destination:=Range("A1")
    With Sheets("BigDataSet - Copy")
        .Range("B65000", .Range("B13000").End(xlUp)).Copy Destination:=Range("B1")
    With Sheets("BigDataSet - Copy")
        .Range("C65000", .Range("C13000").End(xlUp)).Copy Destination:=Range("C1")
    With Sheets("BigDataSet - Copy")
        .Range("D65000", .Range("D13000").End(xlUp)).Copy Destination:=Range("D1")
    With Sheets("BigDataSet - Copy")
        .Range("E65000", .Range("E13000").End(xlUp)).Copy Destination:=Range("E1")
    With Sheets("BigDataSet - Copy")
        .Range("F65000", .Range("F13000").End(xlUp)).Copy Destination:=Range("F1")
    With Sheets("BigDataSet - Copy")
        .Range("G65000", .Range("G13000").End(xlUp)).Copy Destination:=Range("G1")
    With Sheets("BigDataSet - Copy")
        .Range("H65000", .Range("H13000").End(xlUp)).Copy Destination:=Range("H1")
    With Sheets("BigDataSet - Copy")
        .Range("I65000", .Range("I13000").End(xlUp)).Copy Destination:=Range("I1")
    With Sheets("BigDataSet - Copy")
        .Range("J65000", .Range("J13000").End(xlUp)).Copy Destination:=Range("J1")
    End With
    .
    .
    [iterate several times]
    .
    .
    Sheets.Add().Name = "CopySheet7"
    With Sheets("BigDataSet - Copy")
        .Range("A455006", .Range("A502750").End(xlUp)).Copy Destination:=Range("A1")
    With Sheets("BigDataSet - Copy")
        .Range("B455006", .Range("B502750").End(xlUp)).Copy Destination:=Range("B1")
    With Sheets("BigDataSet - Copy")
        .Range("C455006", .Range("C502750").End(xlUp)).Copy Destination:=Range("C1")
    With Sheets("BigDataSet - Copy")
        .Range("D455006", .Range("D502750").End(xlUp)).Copy Destination:=Range("D1")
    With Sheets("BigDataSet - Copy")
        .Range("E455006", .Range("E502750").End(xlUp)).Copy Destination:=Range("E1")
    With Sheets("BigDataSet - Copy")
        .Range("F455006", .Range("F502750").End(xlUp)).Copy Destination:=Range("F1")
    With Sheets("BigDataSet - Copy")
        .Range("G455006", .Range("G502750").End(xlUp)).Copy Destination:=Range("G1")
    With Sheets("BigDataSet - Copy")
        .Range("H455006", .Range("H502750").End(xlUp)).Copy Destination:=Range("H1")
    With Sheets("BigDataSet - Copy")
        .Range("I455006", .Range("I502750").End(xlUp)).Copy Destination:=Range("I1")
    With Sheets("BigDataSet - Copy")
        .Range("J455006", .Range("J502750").End(xlUp)).Copy Destination:=Range("J1")
    End With


End Sub

When I try to run this, I get an error saying “expecting End With”. The goal of the script is to copy ranges of rows and put them into new separate sheets (that I can then put into separate files that will read in Excel 2003 without exceeding the max number of rows). Should there be one or more additional End With statements somewhere in this?

  • 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-06T21:06:48+00:00Added an answer on June 6, 2026 at 9:06 pm

    Not only should there be at least one End With, there shouldn’t be so many With statements.

    Sub RowRangeMove()
        Sheets.Add().Name = "CopySheet"
        With Sheets("BigDataSet - Copy")
            .Range("A65000", .Range("A13000").End(xlUp)).Copy Destination:=Range("A1")
            .Range("B65000", .Range("B13000").End(xlUp)).Copy Destination:=Range("B1")
            .Range("C65000", .Range("C13000").End(xlUp)).Copy Destination:=Range("C1")
            .Range("D65000", .Range("D13000").End(xlUp)).Copy Destination:=Range("D1")
            .Range("E65000", .Range("E13000").End(xlUp)).Copy Destination:=Range("E1")
            .Range("F65000", .Range("F13000").End(xlUp)).Copy Destination:=Range("F1")
            .Range("G65000", .Range("G13000").End(xlUp)).Copy Destination:=Range("G1")
            .Range("H65000", .Range("H13000").End(xlUp)).Copy Destination:=Range("H1")
            .Range("I65000", .Range("I13000").End(xlUp)).Copy Destination:=Range("I1")
            .Range("J65000", .Range("J13000").End(xlUp)).Copy Destination:=Range("J1")
        End With
    
    End Sub
    

    would be the correct syntax.

    The With statement is simply a way to shorten up your lines of code. The With statement is a way of saying “I’m going to perform a bunch of actions on a specific object” and shorten up the individual lines of code.

    Example:

    Without the With statement, the code above would look like this:

    Sub RowRangeMove()
        Sheets.Add().Name = "CopySheet"
            Sheets("BigDataSet - Copy").Range("A65000", .Range("A13000").End(xlUp)).Copy Destination:=Range("A1")
            Sheets("BigDataSet - Copy").Range("B65000", .Range("B13000").End(xlUp)).Copy Destination:=Range("B1")
            Sheets("BigDataSet - Copy").Range("C65000", .Range("C13000").End(xlUp)).Copy Destination:=Range("C1")
            Sheets("BigDataSet - Copy").Range("D65000", .Range("D13000").End(xlUp)).Copy Destination:=Range("D1")
            Sheets("BigDataSet - Copy").Range("E65000", .Range("E13000").End(xlUp)).Copy Destination:=Range("E1")
            Sheets("BigDataSet - Copy").Range("F65000", .Range("F13000").End(xlUp)).Copy Destination:=Range("F1")
            Sheets("BigDataSet - Copy").Range("G65000", .Range("G13000").End(xlUp)).Copy Destination:=Range("G1")
            Sheets("BigDataSet - Copy").Range("H65000", .Range("H13000").End(xlUp)).Copy Destination:=Range("H1")
            Sheets("BigDataSet - Copy").Range("I65000", .Range("I13000").End(xlUp)).Copy Destination:=Range("I1")
            Sheets("BigDataSet - Copy").Range("J65000", .Range("J13000").End(xlUp)).Copy Destination:=Range("J1")
    End Sub
    

    In shorter terms, the With statement allows you to start out individual lines of code with a dot, and inside that with statement, the compiler will assume you mean the thing declared in your with statement.

    So

    With Answerer
      ' Inside this with block, any line beginning with "." , 
      ' the compiler will assume you mean "Answerer.".   
      ' Therefore ".FirstName" is the same as "Answerer.FirstName"
      .FirstName = "David"
      .LastName = "Stratton"
    End With
    

    is equivalient to

    Answerer.FirstName = "David"
    Amswerer.LastName = "Stratton"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sub StoragevsQuota() Charts.Add ActiveChart.ChartType = xlColumnClustered ActiveChart.SetSourceData Source:=Sheets(Data).Range(E1:G32) ActiveChart.Location Where:=xlLocationAsObject, Name:=Storage Charts ActiveChart.Parent.Name =
Public Sub MyFunction() Dim lowstring As String lowstring = hi Me.RichTextView.Find(lowstring, 0, 2) End
Private Sub sendemail(esubj) Sheets(Actual).Select myfridate = Cells(1, 3).Value myfridate = DateAdd(d, -2, myfdate) myfridate
Private Sub importClipboard_Click() Dim data As Collection data = getClipboardData() ...do something... End Sub
Sub StoreUserData2() If SaveFileDialog1.ShowDialog() Then InputBox(MessageStor, TitleStor, SaveFileDialog1.ShowDialog) WriteUserFile() End Sub It allows me
Protected Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu1.MenuItemClick End Sub
Sub omnama() ActiveSheet.Range(Cells($1, $A), Cells($39930, $Q))._ RemoveDuplicates Columns:=Array(1, 2, 6, 7, 8, 9), Header:=xlYes
Public Sub New(ByVal log As Entities.LogSystem) InitializeComponent() Me.DataContext = log End Sub This is
Sub test() thesentence = InputBox(Type the filename with full extension, Raw Data File) Range(A1).Value
Sub GetTextFileData(strSQL As String, strFolder As String, rngTargetCell As Range) ' example: GetTextFileData SELECT

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.