Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default ShowMe function works fine except I need the offset to adjustdepending on column

Can someone point me in the right direction for this?

Function Showme(rngSrc As Range) As String
Dim rng As Range, rngMin As Range, dbl As Double, rngLeft As Range
Dim intOffset As Integer

Set rngMin = rngSrc.Cells(1, 1)
dbl = rngMin.Value
For Each rng In rngSrc
If rng.Value < dbl Then
Set rngMin = rng
dbl = rngMin.Value
End If
Next

'Showme = rngMin.Address
Set rngLeft = rngMin.Offset(, -3).Cells(1, 1)
'MsgBox rngMin.Address
'MsgBox rngLeft.Address
'MsgBox rngLeft.Value

Showme = rngLeft.Value



End Function
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default ShowMe function works fine except I need the offset to adjustdepending on column

Hi
I could not find a question....
regards
Paul

On Nov 25, 6:07*pm, " wrote:
Can someone point me in the right direction for this?

Function Showme(rngSrc As Range) As String
* *Dim rng As Range, rngMin As Range, dbl As Double, rngLeft As Range
* *Dim intOffset As Integer

* *Set rngMin = rngSrc.Cells(1, 1)
* *dbl = rngMin.Value
* *For Each rng In rngSrc
* *If rng.Value < dbl Then
* * * Set rngMin = rng
* * * dbl = rngMin.Value
* *End If
* *Next

* *'Showme = rngMin.Address
* *Set rngLeft = rngMin.Offset(, -3).Cells(1, 1)
* *'MsgBox rngMin.Address
* *'MsgBox rngLeft.Address
* *'MsgBox rngLeft.Value

* *Showme = rngLeft.Value

End Function


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default ShowMe function works fine except I need the offset to adjustdepending on column

On Nov 25, 10:07*am, "
wrote:
Can someone point me in the right direction for this?

Function Showme(rngSrc As Range) As String
* *Dim rng As Range, rngMin As Range, dbl As Double, rngLeft As Range
* *Dim intOffset As Integer

* *Set rngMin = rngSrc.Cells(1, 1)
* *dbl = rngMin.Value
* *For Each rng In rngSrc
* *If rng.Value < dbl Then
* * * Set rngMin = rng
* * * dbl = rngMin.Value
* *End If
* *Next

* *'Showme = rngMin.Address
* *Set rngLeft = rngMin.Offset(, -3).Cells(1, 1)
* *'MsgBox rngMin.Address
* *'MsgBox rngLeft.Address
* *'MsgBox rngLeft.Value

* *Showme = rngLeft.Value

End Function


I solved the problem with the following

intOffset = rngMin.Column
intOffset = "-" & (intOffset - 1)
'Showme = rngMin.Address
Set rngLeft = rngMin.Offset(, intOffset).Cells(1, 1)
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
Visual Basic Function works fine in Excell 2003 but not in Excel 2 Roger Excel Discussion (Misc queries) 8 August 1st 07 03:56 AM
Macro hangs up often but sometimes works fine Jeff Excel Worksheet Functions 3 June 13th 06 01:01 PM
Macro works fine on PC; fails on Mac marlea[_16_] Excel Programming 1 March 20th 06 08:26 PM
Works fine in debug, but... DiBaco Excel Programming 5 February 24th 06 04:35 PM
Offset Function works in cell, not in named range DragonslayerApps Excel Worksheet Functions 0 July 25th 05 04:39 PM


All times are GMT +1. The time now is 02:58 AM.

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"