Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Return Column of Found Data

I am using Excel 2003 SP2.

In providing a series of macros for a workgroup who like to customize their
hotkey assignments, I am attempting to allow them to preserve their setup
from version to version without retaining multiple versions. My plan is to
use a table on a hidden worksheet that sets up their custom assignments when
the file loads.

UserNames Sprinks Johnny Default
Macro Name
Macro A a A a
Macro B x t x
....etc.

Ideally, I would like to search a named range for their username, and either
return the column number, or if it is not found, return the column number of
the one named "Default". Can someone tell me how to do this?

Once the column is determined, I will loop through the list set the key
assignments:

' Pseudocode
intColumn = ' Expression that returns column number
i = 4 ' Data begins in 4th row

Do
strMacroName = Cells(i, 1).Value
strKey = Cells(i,intColumn)
Application.MacroOptions Macro:=strMacroName, ShortcutKey:=strKey
i = i + 1
Loop Until Cells(i,1).Value = ""

Thanks for any assistance.

Sprinks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Return Column of Found Data

Dim res as Variant, rng as Range
res = Application.Match(Application.UserName,rows(1),0)
if not iserror(res) then
set rng = Range("A1:IV1")(1,res)
else
set rng = Range("F1") ' default
end if

--
regards,
Tom Ogilvy


"Sprinks" wrote:

I am using Excel 2003 SP2.

In providing a series of macros for a workgroup who like to customize their
hotkey assignments, I am attempting to allow them to preserve their setup
from version to version without retaining multiple versions. My plan is to
use a table on a hidden worksheet that sets up their custom assignments when
the file loads.

UserNames Sprinks Johnny Default
Macro Name
Macro A a A a
Macro B x t x
...etc.

Ideally, I would like to search a named range for their username, and either
return the column number, or if it is not found, return the column number of
the one named "Default". Can someone tell me how to do this?

Once the column is determined, I will loop through the list set the key
assignments:

' Pseudocode
intColumn = ' Expression that returns column number
i = 4 ' Data begins in 4th row

Do
strMacroName = Cells(i, 1).Value
strKey = Cells(i,intColumn)
Application.MacroOptions Macro:=strMacroName, ShortcutKey:=strKey
i = i + 1
Loop Until Cells(i,1).Value = ""

Thanks for any assistance.

Sprinks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Return Column of Found Data

Thanks, Tom.

Sprinks

"Tom Ogilvy" wrote:

Dim res as Variant, rng as Range
res = Application.Match(Application.UserName,rows(1),0)
if not iserror(res) then
set rng = Range("A1:IV1")(1,res)
else
set rng = Range("F1") ' default
end if

--
regards,
Tom Ogilvy


"Sprinks" wrote:

I am using Excel 2003 SP2.

In providing a series of macros for a workgroup who like to customize their
hotkey assignments, I am attempting to allow them to preserve their setup
from version to version without retaining multiple versions. My plan is to
use a table on a hidden worksheet that sets up their custom assignments when
the file loads.

UserNames Sprinks Johnny Default
Macro Name
Macro A a A a
Macro B x t x
...etc.

Ideally, I would like to search a named range for their username, and either
return the column number, or if it is not found, return the column number of
the one named "Default". Can someone tell me how to do this?

Once the column is determined, I will loop through the list set the key
assignments:

' Pseudocode
intColumn = ' Expression that returns column number
i = 4 ' Data begins in 4th row

Do
strMacroName = Cells(i, 1).Value
strKey = Cells(i,intColumn)
Application.MacroOptions Macro:=strMacroName, ShortcutKey:=strKey
i = i + 1
Loop Until Cells(i,1).Value = ""

Thanks for any assistance.

Sprinks

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
return text value found most frequently in a column globetrotter Excel Worksheet Functions 8 February 8th 09 01:15 PM
Vlookup, return zero if not found molsansk Excel Worksheet Functions 2 August 22nd 06 06:40 PM
Return ROW value for range found Mike Excel Programming 0 April 26th 06 02:35 PM
URGENT -- search in string for a value in another column, if found, return value from next column samkshah Excel Programming 4 October 3rd 05 04:13 PM
Search column - return row found in long text string JayL Excel Programming 1 March 5th 05 03:23 AM


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