Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default i need to record a macro to....

hello,

i have looked endlessly on a way to perform a simple task. PLEASE
HELP!

when i click on a cell in sheet 1, i would like to move to a certain
cell of sheet 2.

if i click on F4 in sheet 1, the i would like to select cell E2 in
sheet 2.
if i click on F5 in sheet 1, the i would like to select cell F2 in
sheet 2.
if i click on F6 in sheet 1, the i would like to select cell G2 in
sheet 2.

and so on.


THANKS IN ADVANCE!!!
Mike C.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default i need to record a macro to....

sorry about the "the" it should read "then"

if i click on F4 in sheet 1, then i would like to select cell E2 in
sheet 2.
if i click on F5 in sheet 1, then i would like to select cell F2 in
sheet 2.
if i click on F6 in sheet 1, then i would like to select cell G2 in
sheet 2.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default i need to record a macro to....

'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------

On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Address = "$F$4" Then
Worksheets("Sheet2").Activate
Worksheets("Sheet2").Range("E2").Select
ElseIf Target.Address = "$F$5" Then
Worksheets("Sheet2").Activate
Worksheets("Sheet2").Range("F2").Select
ElseIf Target.Address = "$F$6" Then
Worksheets("Sheet2").Activate
Worksheets("Sheet2").Range("G2").Select
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.




--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"tinkerbellsmyhoe" wrote in message
ups.com...
hello,

i have looked endlessly on a way to perform a simple task. PLEASE
HELP!

when i click on a cell in sheet 1, i would like to move to a certain
cell of sheet 2.

if i click on F4 in sheet 1, the i would like to select cell E2 in
sheet 2.
if i click on F5 in sheet 1, the i would like to select cell F2 in
sheet 2.
if i click on F6 in sheet 1, the i would like to select cell G2 in
sheet 2.

and so on.


THANKS IN ADVANCE!!!
Mike C.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default i need to record a macro to....

right click on the sheet tab on sheet1 and select view code.

Put in code like this

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.count 1 then exit sub
if Target.column = 6 and Target.row 3 and Target.row < 256 then
worksheets("sheet2").Select
worksheets("Sheet2").Cells(2,Target.row+1).Select
End If
End Sub

--
Regards,
Tom Ogilvy


"tinkerbellsmyhoe" wrote:

hello,

i have looked endlessly on a way to perform a simple task. PLEASE
HELP!

when i click on a cell in sheet 1, i would like to move to a certain
cell of sheet 2.

if i click on F4 in sheet 1, the i would like to select cell E2 in
sheet 2.
if i click on F5 in sheet 1, the i would like to select cell F2 in
sheet 2.
if i click on F6 in sheet 1, the i would like to select cell G2 in
sheet 2.

and so on.


THANKS IN ADVANCE!!!
Mike C.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default i need to record a macro to....

right click sheet tabview codeinsert this
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 6 And Target.Row 1 Then _
Application.Goto Sheets("sheet2").Cells(2, Target.Row + 3)
End Sub

--
Don Guillett
SalesAid Software

"tinkerbellsmyhoe" wrote in message
ups.com...
hello,

i have looked endlessly on a way to perform a simple task. PLEASE
HELP!

when i click on a cell in sheet 1, i would like to move to a certain
cell of sheet 2.

if i click on F4 in sheet 1, the i would like to select cell E2 in
sheet 2.
if i click on F5 in sheet 1, the i would like to select cell F2 in
sheet 2.
if i click on F6 in sheet 1, the i would like to select cell G2 in
sheet 2.

and so on.


THANKS IN ADVANCE!!!
Mike C.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default i need to record a macro to....

Thank you all for replying so quickly and such good information. i
thought this would be a macro type code so that i could apply it to
only the certain buttons or cells that i would like. i need to add a
piece of code so that it only occurs if the cell matches a certain
text. in my case it is if the text in the cell is an "F".

Thanks again in advance,
Mike C.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default i need to record a macro to....

'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------

On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Value = "F" hen
If Target.Address = "$F$4" Then
Worksheets("Sheet2").Activate
Worksheets("Sheet2").Range("E2").Select
ElseIf Target.Address = "$F$5" Then
Worksheets("Sheet2").Activate
Worksheets("Sheet2").Range("F2").Select
ElseIf Target.Address = "$F$6" Then
Worksheets("Sheet2").Activate
Worksheets("Sheet2").Range("G2").Select
End If
End If

ws_exit:
Application.EnableEvents = True
End Sub


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"tinkerbellsmyhoe" wrote in message
oups.com...
Thank you all for replying so quickly and such good information. i
thought this would be a macro type code so that i could apply it to
only the certain buttons or cells that i would like. i need to add a
piece of code so that it only occurs if the cell matches a certain
text. in my case it is if the text in the cell is an "F".

Thanks again in advance,
Mike C.



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default i need to record a macro to....

Man. is there a good complete (CONSISE) book or online reference for
this stuff? this whole time i was trying to use cell.value instead of
target.value. i also tried target.cell and both were incorrect.

I appreciate your help so far....greatly!

thanks,
Mike

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 903
Default i need to record a macro to....

Hi Mike,
Since your specific interest at the moment is in Event macros

Event Macros, Worksheet Events and Workbook Events
http://www.mvps.org/dmcritchie/excel/event.htm

Application Events (Chip Pearson)
http://www.cpearson.com/excel/AppEvent.htm
---
HTH,
David McRitchie, Microsoft MVP - Excel
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"tinkerbellsmyhoe" wrote in message oups.com...
Man. is there a good complete (CONSISE) book or online reference for
this stuff? this whole time i was trying to use cell.value instead of
target.value. i also tried target.cell and both were incorrect.

I appreciate your help so far....greatly!

thanks,
Mike



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default i need to record a macro to....

try this modification
right click sheet tabview codeinsert this
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 6 And Target.Row 1 and ucase(target.value)="F" Then _
Application.Goto Sheets("sheet2").Cells(2, Target.Row + 3)
End Sub


--
Don Guillett
SalesAid Software

"tinkerbellsmyhoe" wrote in message
oups.com...
Thank you all for replying so quickly and such good information. i
thought this would be a macro type code so that i could apply it to
only the certain buttons or cells that i would like. i need to add a
piece of code so that it only occurs if the cell matches a certain
text. in my case it is if the text in the cell is an "F".

Thanks again in advance,
Mike C.





  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default i need to record a macro to....

MAN! This is BS! I am an EE with some coding background and i cant
figure this out for my life. here is the code that i am using:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Target.Column = 6 And Target.Row 3 And Target.Row < 256 And
Target.Value = "F" Then
Worksheets("Test Results").Select
Worksheets("Test Results").Cells(2, Target.Row + 1).Select

End If

If Target.Count 1 Then Exit Sub
If Target.Column = 7 And Target.Row 3 And Target.Row < 256 And
Target.Value = "F" Then
Worksheets("Test Results").Select
Worksheets("Test Results").Cells(13, Target.Row + 1).Select
End If

If Target.Count 1 Then Exit Sub
If Target.Column = 8 And Target.Row 3 And Target.Row < 256 And
Target.Value = "F" Then
Worksheets("Test Results").Select
Worksheets("Test Results").Cells(24, Target.Row + 1).Select
End If

If Target.Count 1 Then Exit Sub
If Target.Column = 9 And Target.Row 3 And Target.Row < 256 And
Target.Value = "F" Then
Worksheets("Test Results").Select
Worksheets("Test Results").Cells(35, Target.Row + 1).Select
End If

If Target.Count 1 Then Exit Sub
If Target.Column = 10 And Target.Row 3 And Target.Row < 256 And
Target.Value = "F" Then
Worksheets("Test Results").Select
Worksheets("Test Results").Cells(46, Target.Row + 1).Select
End If

If Target.Count 1 Then Exit Sub
If Target.Column = 11 And Target.Row 3 And Target.Row < 256 And
Target.Value = "F" Then
Worksheets("Test Results").Select
Worksheets("Test Results").Cells(57, Target.Row + 1).Select
End If

If Target.Count 1 Then Exit Sub
If Target.Column = 12 And Target.Row 3 And Target.Row < 256 And
Target.Value = "F" Then
Worksheets("Test Results").Select
Worksheets("Test Results").Cells(68, Target.Row + 1).Select
End If
If Target.Count 1 Then Exit Sub
If Target.Column = 13 And Target.Row 3 And Target.Row < 256 And
Target.Value = "F" Then
Worksheets("Test Results").Select
Worksheets("Test Results").Cells(77, Target.Row + 1).Select
End If

End Sub

I would like to insert a piece of code into each if statement to change
the target cell + the next 10 rows in that column to a red font. then
change the font back to black (or default) after the selection changes.

i have once again given my best shot and the best i can get (once i get
passed the runtime errors), is for nothing to happen.


Thanks yet again!

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
Record Macro and Edit Macro options disabled Huzza New Users to Excel 1 March 18th 09 03:55 PM
Record New Macro ju1eshart Setting up and Configuration of Excel 3 August 25th 06 04:21 PM
how to record new macro using vba bhavin vyas Excel Programming 0 February 16th 06 06:54 AM
Record Macro - Record custom user actions Sal[_4_] Excel Programming 1 December 23rd 04 03:18 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM


All times are GMT +1. The time now is 03:35 AM.

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"