Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copy and Paste Function

I need some VBA code to search the contents of column AI for certain text,
then if found copy that row's range T:AH and paste it elsewhere. For
instance if "3" is found in T it will need to be pasted into AI:AW. If "4"
is found in T then the same range (T:AH) will need to be pasted into AL:AZ.
And so on...

I know this is easy, but having a hard time getting it to work.

Thanks!
Chris
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Copy and Paste Function

Can you expand on the rules governing how this is supposed to work? Is the
"text" you are looking for always going to be a number as your two examples
show, or will other text be involved? What governs the the range T:AH is to
be copied to (your example has two consecutive values being found in the
same column, but getting mapped ranges that are not consecutively offset
from AI)? Remember, we do not know anything about your set up and what you
want to do with it unless you tell us.

--
Rick (MVP - Excel)


"Outatym" wrote in message
...
I need some VBA code to search the contents of column AI for certain text,
then if found copy that row's range T:AH and paste it elsewhere. For
instance if "3" is found in T it will need to be pasted into AI:AW. If
"4"
is found in T then the same range (T:AH) will need to be pasted into
AL:AZ.
And so on...

I know this is easy, but having a hard time getting it to work.

Thanks!
Chris


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copy and Paste Function

Sorry about not being more descriptive, I didn't want to over load it with
details. Scratch what I said before...

The spread sheet contains voting data within a county. Basically, column T
will have a numerical value (3, 4, 6, 7, 8, 9) representing a constituients
first voting year (2003, 2004, 2006...etc).

Column U is their vote in the Primary of their first voting year and V is
their vote in the General election of that year. Column W has individual's
second voting year. Column X is that year's primary and Y is the general.
And so on for 5 years worth.

The problem is that running a query on this data is not going to work the
way it is, so I will need to sort and move some of the data. I have created
new columns for the voting information that will work better for the database
I'm creating. The new columns are "2003 voting year", "03 Primary", "03
General", "2004 voting year", "04 Primary", "04 General", etc....

I will need the code to search column T for the year (i.e. 3, 4,5....) if it
is 3 then it will need to move all of the voting info (range T:AH) to the new
column for 2003 voting year, then pasted so the data will fill up to
2008(AI:AW). If the there is a 4 in the T column it will need to move the
data (T:AH) to (AL:AZ).

Hope this clears it up some. I know what I'm needing to do, yet am a little
fuzzy on the code to find text, copy a selected range, and to paste it where
it's supposed to go.

Thanks for the help!


"Rick Rothstein" wrote:

Can you expand on the rules governing how this is supposed to work? Is the
"text" you are looking for always going to be a number as your two examples
show, or will other text be involved? What governs the the range T:AH is to
be copied to (your example has two consecutive values being found in the
same column, but getting mapped ranges that are not consecutively offset
from AI)? Remember, we do not know anything about your set up and what you
want to do with it unless you tell us.

--
Rick (MVP - Excel)


"Outatym" wrote in message
...
I need some VBA code to search the contents of column AI for certain text,
then if found copy that row's range T:AH and paste it elsewhere. For
instance if "3" is found in T it will need to be pasted into AI:AW. If
"4"
is found in T then the same range (T:AH) will need to be pasted into
AL:AZ.
And so on...

I know this is easy, but having a hard time getting it to work.

Thanks!
Chris


.

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
copy and paste function mike3004 Excel Worksheet Functions 9 May 27th 08 01:28 PM
Copy and Paste function TamIam Excel Worksheet Functions 3 April 14th 08 11:30 PM
HOw can I use Copy and Paste Function whygh[_2_] Excel Programming 3 December 18th 05 09:55 PM
cut,copy paste function TUNGANA KURMA RAJU Excel Discussion (Misc queries) 0 December 9th 05 07:21 AM
Copy and Paste Function Nigel Excel Programming 1 July 25th 05 06:54 PM


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