Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default selecting cells

Hello,

I'm new to VB and VBA.. I was wondering how I might take the active cell I
am currently on in worksheet 1, and go to that same cell in worksheet 2. I
see how to do it if you make it rigid to a specific cell, but how do I make
it take whatever cell I have selected when it's different every time? (..hope
that makes sense)

Thanks,
Lance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default selecting cells

It's not clear what you want to do. Do you want to go to Worksheet2 if
you've Selected a cell on Worksheet1 or if you've changed a cell on
Worksheet1.

Post back and someone can help. It's a fairly easy solution, I think.

Barb Reinhardt


"Lance" wrote:

Hello,

I'm new to VB and VBA.. I was wondering how I might take the active cell I
am currently on in worksheet 1, and go to that same cell in worksheet 2. I
see how to do it if you make it rigid to a specific cell, but how do I make
it take whatever cell I have selected when it's different every time? (..hope
that makes sense)

Thanks,
Lance

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default selecting cells

I want to select a cell in worksheet 1, then select that same one in
worksheet 2, so worksheet1, cell B20. Then go to worksheet 2, select cell
B20. however, I don't want it set to just B20 though, because next time, it
might be worksheet1 cell A23, worksheet2 cell A23. Does that help?

Lance

"Barb Reinhardt" wrote:

It's not clear what you want to do. Do you want to go to Worksheet2 if
you've Selected a cell on Worksheet1 or if you've changed a cell on
Worksheet1.

Post back and someone can help. It's a fairly easy solution, I think.

Barb Reinhardt


"Lance" wrote:

Hello,

I'm new to VB and VBA.. I was wondering how I might take the active cell I
am currently on in worksheet 1, and go to that same cell in worksheet 2. I
see how to do it if you make it rigid to a specific cell, but how do I make
it take whatever cell I have selected when it's different every time? (..hope
that makes sense)

Thanks,
Lance

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default selecting cells

Right click on the tab for Worksheet1 and select ViewSource. Paste this in
the source


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count < 1 Then Exit Sub

Sheet2.Select
Sheet2.Range(Target.Address).Select

End Sub

Let me know if you want to do something else.
--
HTH,
Barb Reinhardt



"Lance" wrote:

I want to select a cell in worksheet 1, then select that same one in
worksheet 2, so worksheet1, cell B20. Then go to worksheet 2, select cell
B20. however, I don't want it set to just B20 though, because next time, it
might be worksheet1 cell A23, worksheet2 cell A23. Does that help?

Lance

"Barb Reinhardt" wrote:

It's not clear what you want to do. Do you want to go to Worksheet2 if
you've Selected a cell on Worksheet1 or if you've changed a cell on
Worksheet1.

Post back and someone can help. It's a fairly easy solution, I think.

Barb Reinhardt


"Lance" wrote:

Hello,

I'm new to VB and VBA.. I was wondering how I might take the active cell I
am currently on in worksheet 1, and go to that same cell in worksheet 2. I
see how to do it if you make it rigid to a specific cell, but how do I make
it take whatever cell I have selected when it's different every time? (..hope
that makes sense)

Thanks,
Lance



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default selecting cells

Don,

Thanks a lot, that works. Is there anyway to make the sheet generic too?
...so that it just goes to the sheet after the active sheet?

Lance

"Don Guillett" wrote:

Sub gotoactivecellinsht()
Application.Goto Sheets("sheet19").Range(ActiveCell.Address)
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Lance" wrote in message
...
Hello,

I'm new to VB and VBA.. I was wondering how I might take the active cell I
am currently on in worksheet 1, and go to that same cell in worksheet 2. I
see how to do it if you make it rigid to a specific cell, but how do I
make
it take whatever cell I have selected when it's different every time?
(..hope
that makes sense)

Thanks,
Lance



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default selecting cells

This should works...

on error resume next
Application.Goto ActiveCell.Parent.Next.Range(ActiveCell.Address)
on error goto 0

It ends at the last sheet. If you want it to loop around to the frist sheet
again that is a little different...
--
HTH...

Jim Thomlinson


"Lance" wrote:

Don,

Thanks a lot, that works. Is there anyway to make the sheet generic too?
..so that it just goes to the sheet after the active sheet?

Lance

"Don Guillett" wrote:

Sub gotoactivecellinsht()
Application.Goto Sheets("sheet19").Range(ActiveCell.Address)
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Lance" wrote in message
...
Hello,

I'm new to VB and VBA.. I was wondering how I might take the active cell I
am currently on in worksheet 1, and go to that same cell in worksheet 2. I
see how to do it if you make it rigid to a specific cell, but how do I
make
it take whatever cell I have selected when it's different every time?
(..hope
that makes sense)

Thanks,
Lance



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
Selecting multiple cells, I can't see the cells highlighted ET Excel Discussion (Misc queries) 1 August 1st 08 03:20 PM
How to change shade of cells when selecting multiple cells abrummet Excel Discussion (Misc queries) 3 September 6th 07 11:42 AM
By selecting cells adjacent to cells tally sheet tom Excel Worksheet Functions 2 September 20th 06 07:09 PM
Selecting Cells BiggyTwo Excel Worksheet Functions 1 May 19th 06 07:54 PM
Selecting Cells Gabe Excel Programming 8 February 9th 06 09:05 PM


All times are GMT +1. The time now is 06:29 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"