+ Reply to Thread
Results 1 to 4 of 4

Moving the cursor position

Hybrid View

  1. #1
    Peter Longstaff
    Guest

    Moving the cursor position

    Hi All,

    I am fairly new to programming Excel, and when I do itis either through C++
    or C# so my terminoligy may not be correct but this is what I want to do.

    I have to populate several spreadsheets in a workbook from a SQLServer
    database using ADO, which I do without any problems.

    After I have finished populating each sheet I want to move back to cell A1
    and then move on to the next sheet.

    The theory is that when I save the book and re-open it I will see cell A1
    on each sheet. Currently I am on cell AB445, or some such number.

    My question is how do move back to cell A1 after opulating the sheet. I
    will need to know what object the method belongs to, i.e. Workbook,
    Worksheet, Range etc.


    TIA
    Peter

  2. #2
    Jean-Yves
    Guest

    Re: Moving the cursor position

    Hi Peter,
    Worksheets(x).range("A1").activate
    Regards
    JY

    "Peter Longstaff" <peter_dot_longstaff@nowhere_dot_com> wrote in message
    news:Xns9717944A38B13peterdotlongstaffnow@207.46.248.16...
    > Hi All,
    >
    > I am fairly new to programming Excel, and when I do itis either through

    C++
    > or C# so my terminoligy may not be correct but this is what I want to do.
    >
    > I have to populate several spreadsheets in a workbook from a SQLServer
    > database using ADO, which I do without any problems.
    >
    > After I have finished populating each sheet I want to move back to cell A1
    > and then move on to the next sheet.
    >
    > The theory is that when I save the book and re-open it I will see cell A1
    > on each sheet. Currently I am on cell AB445, or some such number.
    >
    > My question is how do move back to cell A1 after opulating the sheet. I
    > will need to know what object the method belongs to, i.e. Workbook,
    > Worksheet, Range etc.
    >
    >
    > TIA
    > Peter




  3. #3
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    you can also do so one time for all worksheets:

    With ActiveWorkbook
    For i = 1 To .Sheets.Count
    .Sheets(i).Select
    Range("a1").Select
    Next
    End With

  4. #4
    The One
    Guest

    Re: Moving the cursor position

    antoka05 <antoka05.1yyjam_1132762209.9552@excelforum-nospam.com> wrote in
    news:antoka05.1yyjam_1132762209.9552@excelforum-nospam.com:

    >
    > you can also do so one time for all worksheets:
    >
    > With ActiveWorkbook
    > For i = 1 To .Sheets.Count
    > Sheets(i).Select
    > Range("a1").Select
    > Next
    > End With
    >
    >


    Unfortunately neither of these suggestions worked. I think it is because
    the workbook is not visible.


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1