PC Review


Reply
Thread Tools Rate Thread

complicated search and extract.... i think

 
 
=?Utf-8?B?bWlrZQ==?=
Guest
Posts: n/a
 
      28th Sep 2007
Hello everybody,
It's been a while since I posted last, but yet again I'm here to ask for
your wisdom and advice.

The task: I have a worksheet, each column contains specific information.
Row 2 is the company location.
I would like to create a macro to search for a location, so for every
occurence of "london" in Row 2. I would then like to copy this information to
a new sheet, rename the sheet and print.
The macro needs to extract information from row 1 and row 5 of each column
and place this in the new sheet.

ie. current sheet...
co. x co. y co. z
row 1 a d f
row 2 b b g
row 3 c e h

the new sheet

co. x b a
co. y b d

I hope that make sense.
Ok, so I know how to write a simple macro and get it going but I don't know
where to begin or how to loop, search, extract, etc.

Any help would be greatly appreciated.
Thanking you

Mike
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SlJGb3Jt?=
Guest
Posts: n/a
 
      28th Sep 2007
mike,

Do you want to search the location row which is row2?
Then copy the data from row1 and row 5 for the new sheet?
If you need to copy the data from row 5 and row 1 of the same column then
this code may help

assuming your searching row 2 for London

Sub Mike()
Dim r1, r5 As String
Sheets("Sheet4").Select
Range("a21").Select 'Just where I started
If ActiveCell <> "" Then
Do Until ActiveCell = ""
If ActiveCell = "London" Then
r1 = ActiveCell.Offset(-1, 0)
r5 = ActiveCell.Offset(3, 0)
End If
ActiveCell.Offset(0, 1).Select
Loop
End If

Is this part of what you are looking for?



"mike" wrote:

> Hello everybody,
> It's been a while since I posted last, but yet again I'm here to ask for
> your wisdom and advice.
>
> The task: I have a worksheet, each column contains specific information.
> Row 2 is the company location.
> I would like to create a macro to search for a location, so for every
> occurence of "london" in Row 2. I would then like to copy this information to
> a new sheet, rename the sheet and print.
> The macro needs to extract information from row 1 and row 5 of each column
> and place this in the new sheet.
>
> ie. current sheet...
> co. x co. y co. z
> row 1 a d f
> row 2 b b g
> row 3 c e h
>
> the new sheet
>
> co. x b a
> co. y b d
>
> I hope that make sense.
> Ok, so I know how to write a simple macro and get it going but I don't know
> where to begin or how to loop, search, extract, etc.
>
> Any help would be greatly appreciated.
> Thanking you
>
> Mike

 
Reply With Quote
 
=?Utf-8?B?bWlrZQ==?=
Guest
Posts: n/a
 
      29th Sep 2007
Hi JRForm,

Thanks for helping.
That is what I'm looking for, I'll try and let you know what happens.
Thanks.

Mike

"JRForm" wrote:

> mike,
>
> Do you want to search the location row which is row2?
> Then copy the data from row1 and row 5 for the new sheet?
> If you need to copy the data from row 5 and row 1 of the same column then
> this code may help
>
> assuming your searching row 2 for London
>
> Sub Mike()
> Dim r1, r5 As String
> Sheets("Sheet4").Select
> Range("a21").Select 'Just where I started
> If ActiveCell <> "" Then
> Do Until ActiveCell = ""
> If ActiveCell = "London" Then
> r1 = ActiveCell.Offset(-1, 0)
> r5 = ActiveCell.Offset(3, 0)
> End If
> ActiveCell.Offset(0, 1).Select
> Loop
> End If
>
> Is this part of what you are looking for?
>
>
>
> "mike" wrote:
>
> > Hello everybody,
> > It's been a while since I posted last, but yet again I'm here to ask for
> > your wisdom and advice.
> >
> > The task: I have a worksheet, each column contains specific information.
> > Row 2 is the company location.
> > I would like to create a macro to search for a location, so for every
> > occurence of "london" in Row 2. I would then like to copy this information to
> > a new sheet, rename the sheet and print.
> > The macro needs to extract information from row 1 and row 5 of each column
> > and place this in the new sheet.
> >
> > ie. current sheet...
> > co. x co. y co. z
> > row 1 a d f
> > row 2 b b g
> > row 3 c e h
> >
> > the new sheet
> >
> > co. x b a
> > co. y b d
> >
> > I hope that make sense.
> > Ok, so I know how to write a simple macro and get it going but I don't know
> > where to begin or how to loop, search, extract, etc.
> >
> > Any help would be greatly appreciated.
> > Thanking you
> >
> > Mike

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Complicated search and complete analysis on results elf4278 Microsoft Excel Programming 4 9th Jul 2009 05:08 AM
Re: Complicated search set up? Allen Browne Microsoft Access Forms 0 21st Mar 2008 08:36 PM
Search and extract =?Utf-8?B?R29yZG9u?= Microsoft Excel Programming 1 4th Sep 2006 11:20 AM
Help with a complicated search function in Excel =?Utf-8?B?SXJvbm1hbjI3Mw==?= Microsoft Excel Worksheet Functions 1 9th Jan 2006 04:10 AM
Using Outlook is so complicated. You must search to find everythi =?Utf-8?B?VFJBREVNQVJLTElRVUlEQVRPUlM0MTEuQ09N?= Microsoft Outlook 8 3rd Nov 2005 02:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:20 PM.