ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Moving the cursor position (https://www.excelbanter.com/excel-programming/346425-moving-cursor-position.html)

Peter Longstaff[_2_]

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

Jean-Yves[_2_]

Moving the cursor position
 
Hi Peter,
Worksheets(x).range("A1").activate
Regards
JY

"Peter Longstaff" <peter_dot_longstaff@nowhere_dot_com wrote in message
48.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




antoka05[_6_]

Moving the cursor position
 

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 Wit

--
antoka0
-----------------------------------------------------------------------
antoka05's Profile: http://www.excelforum.com/member.php...fo&userid=2902
View this thread: http://www.excelforum.com/showthread.php?threadid=48763


The One

Moving the cursor position
 
antoka05 wrote in
:


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.



All times are GMT +1. The time now is 11:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com