Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I have a worksheet where the user uses one row for an item; each item can have zero to about 6 subitems that these users put each subitem (say, in column G) on separate lines for readability using <cntl-enter. They've asked me to use VBA code to detect a certain type of entry (with a userform, so they can select what type of entry to search for). When that entry is found, they want me to pull _just_ the corresponding line from Column H. Basically; ------------------------------------ Item SubitemA DetailA SubitemB DetailB SubitemC DetailC ------------------------------------- Item SubitemA DetailA SubitemB DetailB SubitemC DetailC ------------------------------------- So if the select Subitem B, I should pull each Detail B and pull it over to the report I'm creating. Right now, I'm cycling through each cell to see if DetailB is present, then trying to parse based on how many returns are in the cell... is there a better/easier way? Has anyone done this before that could provide a code snippet for me to test and adapt? Many Thanks, Keith -- The enclosed questions or comments are entirely mine and don't represent the thoughts, views, or policy of my employer. Any errors or omissions are my own. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It might make it easier to parse if you used split() (added in xl2k) to separate
the entries based on vblf's. Then you could loop through the array looking for what you want. instr() may help you look through the original string first. KR wrote: I have a worksheet where the user uses one row for an item; each item can have zero to about 6 subitems that these users put each subitem (say, in column G) on separate lines for readability using <cntl-enter. They've asked me to use VBA code to detect a certain type of entry (with a userform, so they can select what type of entry to search for). When that entry is found, they want me to pull _just_ the corresponding line from Column H. Basically; ------------------------------------ Item SubitemA DetailA SubitemB DetailB SubitemC DetailC ------------------------------------- Item SubitemA DetailA SubitemB DetailB SubitemC DetailC ------------------------------------- So if the select Subitem B, I should pull each Detail B and pull it over to the report I'm creating. Right now, I'm cycling through each cell to see if DetailB is present, then trying to parse based on how many returns are in the cell... is there a better/easier way? Has anyone done this before that could provide a code snippet for me to test and adapt? Many Thanks, Keith -- The enclosed questions or comments are entirely mine and don't represent the thoughts, views, or policy of my employer. Any errors or omissions are my own. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Pulling a cell reference--clickable cells? | Excel Worksheet Functions | |||
Reference text in a cell inside a formula to specify a sheet name | Excel Worksheet Functions | |||
How 2 Link DATA instead of CELL REFERENCE - Pulling My Hair Out! | New Users to Excel | |||
How do I insert a new line of text inside a cell | New Users to Excel | |||
Creating a Checkbox inside a cell for each line | Excel Programming |