Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 465
Default Where best to place an instruction in a VBA script


Hi All

I'm using this code when I open my workbook.

Private Sub Workbook_Open()
Dim mysheets As Sheets
Set mysheets = Worksheets(Array(1))
For Each Sheet In mysheets
Sheets("ShareSheet").ScrollArea = "A1:J27"

Next


End Sub


I'd like cell A200 to be selected and have the cursor box on it on
opening the worksheet.

I'm trying to place this line in the code :

Application.Goto Reference:="R200C1"

but can't get it to work.

Can someone advise please?

Grateful for any assistance.


Best Wishes
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,942
Default Where best to place an instruction in a VBA script

hi
Range("A200").select

Regards
FSt1

"Colin Hayes" wrote:


Hi All

I'm using this code when I open my workbook.

Private Sub Workbook_Open()
Dim mysheets As Sheets
Set mysheets = Worksheets(Array(1))
For Each Sheet In mysheets
Sheets("ShareSheet").ScrollArea = "A1:J27"

Next


End Sub


I'd like cell A200 to be selected and have the cursor box on it on
opening the worksheet.

I'm trying to place this line in the code :

Application.Goto Reference:="R200C1"

but can't get it to work.

Can someone advise please?

Grateful for any assistance.


Best Wishes
.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Where best to place an instruction in a VBA script

Try

Application.Goto Range("A200"), True

OR add this to the worksheet Activate event as below...

Private Sub Worksheet_Activate()
Application.Goto Range("A200"), True
End Sub

--
Jacob


"Colin Hayes" wrote:


Hi All

I'm using this code when I open my workbook.

Private Sub Workbook_Open()
Dim mysheets As Sheets
Set mysheets = Worksheets(Array(1))
For Each Sheet In mysheets
Sheets("ShareSheet").ScrollArea = "A1:J27"

Next


End Sub


I'd like cell A200 to be selected and have the cursor box on it on
opening the worksheet.

I'm trying to place this line in the code :

Application.Goto Reference:="R200C1"

but can't get it to work.

Can someone advise please?

Grateful for any assistance.


Best Wishes
.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 465
Default Where best to place an instruction in a VBA script

In article , FSt1
writes
hi
Range("A200").select

Regards
FSt1


Hi

Ok thanks for getting back. That's fixed it now. Worked first time.



Best Wishes




Hi All

I'm using this code when I open my workbook.

Private Sub Workbook_Open()
Dim mysheets As Sheets
Set mysheets = Worksheets(Array(1))
For Each Sheet In mysheets
Sheets("ShareSheet").ScrollArea = "A1:J27"

Next


End Sub


I'd like cell A200 to be selected and have the cursor box on it on
opening the worksheet.

I'm trying to place this line in the code :

Application.Goto Reference:="R200C1"

but can't get it to work.

Can someone advise please?

Grateful for any assistance.


Best Wishes
.


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 690
Default Where best to place an instruction in a VBA script

I'm trying to place this line in the code :
Application.Goto Reference:="R200C1"


Hi. I'm glad it's working. It was a little confusing because one can't
select A200 after restrinting the selection to A1:J27

Worksheets(Array(1))


Unless I'm mistaken, this appears to only return 1 sheet.

Goto Reference:="R200C1"


Just to mention...if you want to use numbers instead of strings,
consider the Cells Property.

Here's my best guess on the code you posted.
Just note that Worksheets(1) "could" be ShareSheet, and you can't select
A200 when the scroll area is restricted to A1:J27.

Sub Demo()
Dim MySheet
Set MySheet = Worksheets(1)
Application.Goto MySheet.Cells(200, 1)

'Note: You can't Select A200 on "ShareSheet"
Sheets("ShareSheet").ScrollArea = "A1:J27"
End Sub

= = = = = = =
HTH :)
Dana DeLouis




On 1/19/2010 7:52 AM, Colin Hayes wrote:
In article , FSt1
writes
hi
Range("A200").select

Regards
FSt1


Hi

Ok thanks for getting back. That's fixed it now. Worked first time.



Best Wishes




Hi All

I'm using this code when I open my workbook.

Private Sub Workbook_Open()
Dim mysheets As Sheets
Set mysheets = Worksheets(Array(1))
For Each Sheet In mysheets
Sheets("ShareSheet").ScrollArea = "A1:J27"

Next


End Sub


I'd like cell A200 to be selected and have the cursor box on it on
opening the worksheet.

I'm trying to place this line in the code :

Application.Goto Reference:="R200C1"

but can't get it to work.

Can someone advise please?

Grateful for any assistance.


Best Wishes
.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What Instruction? johnsail Excel Discussion (Misc queries) 3 March 9th 09 09:51 AM
Blocking Cells if instruction not followed stew Excel Discussion (Misc queries) 0 December 14th 08 12:41 PM
how do I display an instruction in a cell? matty Excel Discussion (Misc queries) 2 September 27th 08 01:18 AM
How do I delete an instruction box? Priscilla Excel Worksheet Functions 2 June 24th 07 06:21 AM
template for works instruction sparkiebri New Users to Excel 0 March 9th 05 05:21 PM


All times are GMT +1. The time now is 02:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"