Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 440
Default Offset the result

If cell L5 has focus, can call L1 display the contents of L4 + 50?
--
Traa Dy Liooar

Jock
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Offset the result

Hi,

With L5 as the active cell try this

Range("L1").Value = ActiveCell.Offset(, -1) + 50

Mike

"Jock" wrote:

If cell L5 has focus, can call L1 display the contents of L4 + 50?
--
Traa Dy Liooar

Jock

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Offset the result

OOPS,

that should have been

Range("L1").Value = ActiveCell.Offset(-1) + 50

Mike

"Mike H" wrote:

Hi,

With L5 as the active cell try this

Range("L1").Value = ActiveCell.Offset(, -1) + 50

Mike

"Jock" wrote:

If cell L5 has focus, can call L1 display the contents of L4 + 50?
--
Traa Dy Liooar

Jock

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 440
Default Offset the result

Hi Mike,

I have placed your code within a Private Sub DoubleClick (see below). This
works until the user double cluicks a cell with no data in it when the code
stops working until the spreadsheet is closed down and opened again.
Can something be put in to ignore double clicks in empty cells?
And is there such a thing as a "single click" alternative?

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("k6:k30")) Is Nothing Then
With Target
If .Value < "" Then
Range("L2").Value = ActiveCell.Offset(0, -2) + 50
Application.EnableEvents = True
End If
End With
End If
End Sub


Thanks.
--
Traa Dy Liooar

Jock


"Mike H" wrote:

OOPS,

that should have been

Range("L1").Value = ActiveCell.Offset(-1) + 50

Mike

"Mike H" wrote:

Hi,

With L5 as the active cell try this

Range("L1").Value = ActiveCell.Offset(, -1) + 50

Mike

"Jock" wrote:

If cell L5 has focus, can call L1 display the contents of L4 + 50?
--
Traa Dy Liooar

Jock

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Offset the result

Hi,

You were disabling events at the wrong time

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Not Intersect(Target, Me.Range("k6:k30")) Is Nothing Then
With Target
If .Value < "" Then
Application.EnableEvents = False
Range("L2").Value = ActiveCell.Offset(0, -2) + 50
Application.EnableEvents = True
End If
End With
End If
End Sub

Mike

"Jock" wrote:

Hi Mike,

I have placed your code within a Private Sub DoubleClick (see below). This
works until the user double cluicks a cell with no data in it when the code
stops working until the spreadsheet is closed down and opened again.
Can something be put in to ignore double clicks in empty cells?
And is there such a thing as a "single click" alternative?

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("k6:k30")) Is Nothing Then
With Target
If .Value < "" Then
Range("L2").Value = ActiveCell.Offset(0, -2) + 50
Application.EnableEvents = True
End If
End With
End If
End Sub


Thanks.
--
Traa Dy Liooar

Jock


"Mike H" wrote:

OOPS,

that should have been

Range("L1").Value = ActiveCell.Offset(-1) + 50

Mike

"Mike H" wrote:

Hi,

With L5 as the active cell try this

Range("L1").Value = ActiveCell.Offset(, -1) + 50

Mike

"Jock" wrote:

If cell L5 has focus, can call L1 display the contents of L4 + 50?
--
Traa Dy Liooar

Jock



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 440
Default Offset the result

Thats better!
Quick question, could the GotFocus event be used in this scenario rather
than the
BeforeDoubleClick? Users will moan.....
--
Traa Dy Liooar

Jock


"Mike H" wrote:

Hi,

You were disabling events at the wrong time

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Not Intersect(Target, Me.Range("k6:k30")) Is Nothing Then
With Target
If .Value < "" Then
Application.EnableEvents = False
Range("L2").Value = ActiveCell.Offset(0, -2) + 50
Application.EnableEvents = True
End If
End With
End If
End Sub

Mike

"Jock" wrote:

Hi Mike,

I have placed your code within a Private Sub DoubleClick (see below). This
works until the user double cluicks a cell with no data in it when the code
stops working until the spreadsheet is closed down and opened again.
Can something be put in to ignore double clicks in empty cells?
And is there such a thing as a "single click" alternative?

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("k6:k30")) Is Nothing Then
With Target
If .Value < "" Then
Range("L2").Value = ActiveCell.Offset(0, -2) + 50
Application.EnableEvents = True
End If
End With
End If
End Sub


Thanks.
--
Traa Dy Liooar

Jock


"Mike H" wrote:

OOPS,

that should have been

Range("L1").Value = ActiveCell.Offset(-1) + 50

Mike

"Mike H" wrote:

Hi,

With L5 as the active cell try this

Range("L1").Value = ActiveCell.Offset(, -1) + 50

Mike

"Jock" wrote:

If cell L5 has focus, can call L1 display the contents of L4 + 50?
--
Traa Dy Liooar

Jock

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Offset the result

Hi,

Thers is no getfocus event for a cell only selection_change.

Mike

"Jock" wrote:

Thats better!
Quick question, could the GotFocus event be used in this scenario rather
than the
BeforeDoubleClick? Users will moan.....
--
Traa Dy Liooar

Jock


"Mike H" wrote:

Hi,

You were disabling events at the wrong time

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Not Intersect(Target, Me.Range("k6:k30")) Is Nothing Then
With Target
If .Value < "" Then
Application.EnableEvents = False
Range("L2").Value = ActiveCell.Offset(0, -2) + 50
Application.EnableEvents = True
End If
End With
End If
End Sub

Mike

"Jock" wrote:

Hi Mike,

I have placed your code within a Private Sub DoubleClick (see below). This
works until the user double cluicks a cell with no data in it when the code
stops working until the spreadsheet is closed down and opened again.
Can something be put in to ignore double clicks in empty cells?
And is there such a thing as a "single click" alternative?

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("k6:k30")) Is Nothing Then
With Target
If .Value < "" Then
Range("L2").Value = ActiveCell.Offset(0, -2) + 50
Application.EnableEvents = True
End If
End With
End If
End Sub


Thanks.
--
Traa Dy Liooar

Jock


"Mike H" wrote:

OOPS,

that should have been

Range("L1").Value = ActiveCell.Offset(-1) + 50

Mike

"Mike H" wrote:

Hi,

With L5 as the active cell try this

Range("L1").Value = ActiveCell.Offset(, -1) + 50

Mike

"Jock" wrote:

If cell L5 has focus, can call L1 display the contents of L4 + 50?
--
Traa Dy Liooar

Jock

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
Offset/Match when there is more than 1 result kpotg24 Excel Worksheet Functions 3 November 23rd 09 06:05 PM
Offset a formula result Patrick C. Simonds Excel Worksheet Functions 1 August 16th 09 11:06 PM
large function result as reference for offset function Z Excel Discussion (Misc queries) 1 May 5th 09 12:55 AM
Array Formula - Offset Result Problem Vlad[_8_] Excel Programming 9 March 4th 08 10:48 AM
Select row (with offset) from VB formula result RAP Excel Programming 1 August 7th 05 09:22 AM


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