Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro help for a beginner


ive merged the 2 formulas togeather as i liked the offset idea in th
first formula, and have now changed it to operate 2 columns, onl
problem this has caused is the i need to offset to a peticular column
as in i am using the macro on columns D & E, when i click a cell i
each of these the tick appears (great) but i want the cell to shift t
the cell in column G (same row). if i change the offset number to (o
3) it is fine for column D but when i click on column E the cell jump
across to column H, any ideas? cheer

--
Dan
-----------------------------------------------------------------------
Danz's Profile: http://www.excelforum.com/member.php...fo&userid=1644
View this thread: http://www.excelforum.com/showthread.php?threadid=27808

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default macro help for a beginner

Danz

Try this

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim iOffset As Integer
On Error GoTo err_handler
Application.EnableEvents = False
If Not Application.Intersect(Target, Columns("D:E")) Is Nothing Then
If Target.Column = 4 Then
iOffset = 3
Else
iOffset = 2
End If
If IsEmpty(Target.Value) Then
With Target
..Font.Name = "Wingdings"
..Value = Chr(252)
End With
Target.Offset(0, iOffset).Select
Else
Target.Value = ""
End If
End If
err_handler:
Application.EnableEvents = True
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Danz" wrote in message
...

ive merged the 2 formulas togeather as i liked the offset idea in the
first formula, and have now changed it to operate 2 columns, only
problem this has caused is the i need to offset to a peticular column,
as in i am using the macro on columns D & E, when i click a cell in
each of these the tick appears (great) but i want the cell to shift to
the cell in column G (same row). if i change the offset number to (o,
3) it is fine for column D but when i click on column E the cell jumps
across to column H, any ideas? cheers


--
Danz
------------------------------------------------------------------------
Danz's Profile:
http://www.excelforum.com/member.php...o&userid=16448
View this thread: http://www.excelforum.com/showthread...hreadid=278087



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default macro help for a beginner

Sorry..forgot to add second offset if you are removing a tick

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim iOffset As Integer
On Error GoTo err_handler
Application.EnableEvents = False
If Not Application.Intersect(Target, Columns("D:E")) Is Nothing Then
If Target.Column = 4 Then
iOffset = 3
Else
iOffset = 2
End If
If IsEmpty(Target.Value) Then
With Target
..Font.Name = "Wingdings"
..Value = Chr(252)
End With
Target.Offset(0, iOffset).Select
Else
Target.Value = ""
Target.Offset(0, iOffset).Select
End If
End If
err_handler:
Application.EnableEvents = True
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Nick Hodge" wrote in message
...
Danz

Try this

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim iOffset As Integer
On Error GoTo err_handler
Application.EnableEvents = False
If Not Application.Intersect(Target, Columns("D:E")) Is Nothing Then
If Target.Column = 4 Then
iOffset = 3
Else
iOffset = 2
End If
If IsEmpty(Target.Value) Then
With Target
.Font.Name = "Wingdings"
.Value = Chr(252)
End With
Target.Offset(0, iOffset).Select
Else
Target.Value = ""
End If
End If
err_handler:
Application.EnableEvents = True
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Danz" wrote in message
...

ive merged the 2 formulas togeather as i liked the offset idea in the
first formula, and have now changed it to operate 2 columns, only
problem this has caused is the i need to offset to a peticular column,
as in i am using the macro on columns D & E, when i click a cell in
each of these the tick appears (great) but i want the cell to shift to
the cell in column G (same row). if i change the offset number to (o,
3) it is fine for column D but when i click on column E the cell jumps
across to column H, any ideas? cheers


--
Danz
------------------------------------------------------------------------
Danz's Profile:
http://www.excelforum.com/member.php...o&userid=16448
View this thread:
http://www.excelforum.com/showthread...hreadid=278087





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
Macro for a beginner Masha Excel Discussion (Misc queries) 2 February 14th 06 06:42 AM
Macro beginner - Echo Mary Ann Excel Discussion (Misc queries) 2 December 10th 05 12:41 PM
macro help for a beginner Danz[_3_] Excel Programming 1 November 15th 04 07:51 AM
macro help for a beginner Danz[_2_] Excel Programming 0 November 14th 04 10:56 AM
macro help for a beginner Danz Excel Programming 2 November 14th 04 10:20 AM


All times are GMT +1. The time now is 10:22 PM.

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

About Us

"It's about Microsoft Excel"