ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   i need to record a macro to.... (https://www.excelbanter.com/excel-programming/358890-i-need-record-macro.html)

tinkerbellsmyhoe

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.


tinkerbellsmyhoe

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.


Bob Phillips[_6_]

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.




Tom Ogilvy

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.



Don Guillett

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.




tinkerbellsmyhoe

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.


Bob Phillips[_6_]

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.




tinkerbellsmyhoe

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


David McRitchie

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




Don Guillett

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.




tinkerbellsmyhoe

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!



All times are GMT +1. The time now is 05:23 PM.

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