LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Function needed to pull in cell values

Is there a function I could create in Excel 2007 VBA module that would look
a range of cells and pull in the values.
In columns A - F, I have column headers,
Column A - Hand Tools
Column B - Power Tools
Column C - Lawn and Garden Tools
Column D - Misc Tools
Column E - Yard Accessories
Column F - Misc
Each will have values of either a "Y" or"N", starting in row 2
In Column G, header is titled "Equip. Sold".
I have a macro that pulls in the column header if ="Y" in columns A - F.
However I am looking to achieve something a little different. I need to
indicate "Tools" in cell G2 to final row, if cell value = "Y" in any of the
columns A through D, than pull in remaining columns headers, E through F if
cell value ="Y".

Example:
If column A(Hand Tools) ="Y"
column B (Power Tools) ="N'
column C (Lawn and Garden Tools)="Y"
column D (Misc Tools) ="Y"
column E ( Yard Accessories) ="N"
column F ( Misc) ="Y".
Than cell G2 -= Tool, Yard Accessories, Misc

Here is my current module I am using:

Function Mstring(myrange)
Set myEquip = Range("A1:F1")
mycount = myrange.Count
myflag = True
For j = 1 To mycount
If myrange(j) = "Y" Then
If myflag Then
Mstring = Mstring & myEquip(j)
myflag = False
Else
Mstring = Mstring & "," & myEquip(j)
End If
End If
Next j
End Function

Thank you for your suggestions in advance. I would include an attachment but
not sure if possible in this discussion group, if so please advise how to
include attachments. Thank you :)
 
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
Function needed to search and pull data from 1 table to another Heidi Excel Worksheet Functions 4 February 5th 10 08:05 PM
Macro Needed to pull specific columns from worksheet Jennifer Excel Programming 8 April 30th 08 11:07 AM
VAB to copy cell values into new Sheet, Overwrite if needed and based off of Cell Value in a column gumby Excel Programming 4 July 14th 07 01:55 AM
macro or function help needed for adding columns for values missin Arain Excel Discussion (Misc queries) 10 May 17th 07 12:46 AM
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) [email protected] Excel Worksheet Functions 0 September 5th 06 03:44 PM


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