Macro to copy & paste-special-values data to selected worksheets

I have a workbook containing worksheets called “List-1”, “List-2”, “List-3”, 
“List-4” and many other worksheet “templates”. I need a macro to perform the 
following:

1.  On any of the particular worksheet templates, copy the data on the 
entire row for all rows within the range A1:H50 only if the value for that 
row in column H is greater than 0, and then “paste special values” the data 
on the worksheet called “List-1” starting at cell A1. In other words, for any 
row within the range that has a value in column H that is greater than 0, the 
entire row of data in column A-H will be copied and pasted (paste special 
values) on “List-1”. 

2.  Perform the same routine as step 1 except select the data in cells 
A51:H100 and paste-special-values on “List-2” starting at cell A1.

3.  Perform the same routine as step 1 except select the data in cells 
A101:H150 and paste-special-values on “List-3” starting at cell A1.

4.  Perform the same routine as step 1 except select the data in cells 
A151:H200 and paste-special-values on “List-4” starting at cell A1.

5.  Return back to the original worksheet template, select cell A1, and 
escape to eliminate any evidence of the range selection (dashed borders) that 
was used to copy data in step 1-4. 

I’ll use a button to activate the macro on each individual worksheet 
template. When the user activates the macro on the first template worksheet, 
the data will be copied, and pasted (paste special values) to each of the 
lists as noted above. When the user activates the macro on any of the 
subsequent templates, the data will copied and pasted (paste special values) 
on each of the lists starting at the next empty row in column A. In other 
words, I want the user to be able to continue to add data to “List-1”, 
“List-2”, List-3” and “List-4” from any of the template worksheets.

I don’t have much experience with vba therefore, any help for a novice to 
apply this would be greatly appreciated.

Thanks in advance,

Tom 

0
Utf
5/4/2010 11:31:01 PM
excel.misc 78881 articles. 5 followers. Follow

1 Replies
1160 Views

Similar Articles

[PageSpeed] 51

On May 5, 7:31=A0am, tomhelle <tomhe...@discussions.microsoft.com>
wrote:
> I have a workbook containing worksheets called =93List-1=94, =93List-2=94=
, =93List-3=94,
> =93List-4=94 and many other worksheet =93templates=94. I need a macro to =
perform the
> following:
>
> 1. =A0On any of the particular worksheet templates, copy the data on the
> entire row for all rows within the range A1:H50 only if the value for tha=
t
> row in column H is greater than 0, and then =93paste special values=94 th=
e data
> on the worksheet called =93List-1=94 starting at cell A1. In other words,=
 for any
> row within the range that has a value in column H that is greater than 0,=
 the
> entire row of data in column A-H will be copied and pasted (paste special
> values) on =93List-1=94.
>
> 2. =A0Perform the same routine as step 1 except select the data in cells
> A51:H100 and paste-special-values on =93List-2=94 starting at cell A1.
>
> 3. =A0Perform the same routine as step 1 except select the data in cells
> A101:H150 and paste-special-values on =93List-3=94 starting at cell A1.
>
> 4. =A0Perform the same routine as step 1 except select the data in cells
> A151:H200 and paste-special-values on =93List-4=94 starting at cell A1.
>
> 5. =A0Return back to the original worksheet template, select cell A1, and
> escape to eliminate any evidence of the range selection (dashed borders) =
that
> was used to copy data in step 1-4.
>
> I=92ll use a button to activate the macro on each individual worksheet
> template. When the user activates the macro on the first template workshe=
et,
> the data will be copied, and pasted (paste special values) to each of the
> lists as noted above. When the user activates the macro on any of the
> subsequent templates, the data will copied and pasted (paste special valu=
es)
> on each of the lists starting at the next empty row in column A. In other
> words, I want the user to be able to continue to add data to =93List-1=94=
,
> =93List-2=94, List-3=94 and =93List-4=94 from any of the template workshe=
ets.
>
> I don=92t have much experience with vba therefore, any help for a novice =
to
> apply this would be greatly appreciated.
>
> Thanks in advance,
>
> Tom

Air code:

for i=3D1 to 4
   set rng=3Drange("H" & (i-1)*50+1 & ":H" & (i*50))
   for each c in rng
      if c>0 then
         c.entirerow.copy
         worksheets("List-" & i).cells(rows.count,
1).end(xlup).offset(1).pastespecial
      end if
   next c
next i

Application.CutCopyMode =3D False
Range("A1").Select
0
PY
5/5/2010 1:00:14 PM
Reply:

Similar Artilces:

Macro warning with no macros
I have a workbook that when I try to open it I get the warning tellin me it contains macros and asking whether I want to Enable or Disabl them. I put no macros, no VB scripts, nothing at all in the workboo other than standard Excel formulas and some charts. I developed it i Excel 2002, SP-2, but have moved it back and forth between tw computers, the other which has Excel 97. Regardless of whether Enable or Disable or change the security settings so as not to get th warning, once the workbook is open even if I go t Tools-Macro-Macros... it lists no macros. How can I find out what's cau...

Hyperlink to a bookmark created in Word and copied to Windows Mail don't work
A bookmark created in Windows Mail along with the hyperlink to it don't work when copied to Windows Mail for e-mailing I get an error message: mid://00000174/ ...

Macro
Can anybody tell me how to kick off a macro automatically as file is opened? Regards ...

Stupid 'Copy' button
Hi, Why does RMS preserve quantity and commited values & serial numbers (amongst others) when you are use the 'copy' function for setting up a new code - this is crazy!!!! Is there an SQL script available I can use to set the correct committed values for any items which have been created by the 'copy' button? I am going to have to tell the customer perform a physical inventory to get the quantity on hand values correct - but committed is more important to fix straight away as they use this for ordering purposes. Can anyone help me? Regards, Jason. ...

Removing Duplicate Values
Hello all I have a column of data made up of 100 cells. Some cells have a unique value and others the same value. Using a formula in another column, is there a way I can be left with just a list of unique values e.g. if X comes up 3 times in the original column how can I show it just once in another? I know I can use remove duplicates in excel but I don't want to as I don't want to have to use macros thanks -- James. Hi, take a look to CPearson web http://www.cpearson.com/excel/Duplicates.aspx at the end of the page there is a link as well theat will ...

Copying a variable nuimber of rows
I want to copy the most recent 10 rows (excluding the header row) from worksheet A to worksheet B. My problem is how do I define a variable number of rows if there are fewer than 10 lines completed? I do not want to copy any blank lines. I am fairly new to VBA and am struggling to work out the code for this so any help will be gratefully appreciated. John Try With Activesheet LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row if LastRow > 10 Then FirstRow = LastRow - 9 Else FirstRow = 1 EndIf ...

Macro
Version: 2008 Operating System: Mac OS X 10.4 (Tiger) Processor: intel Hi, I'm thinking of buying Mac: Office 2008, but before I do I want to check that I will be able to download Scritpsmart collection of templates without any glitches: <http://www.bbc.co.uk/writersroom/scriptsmart/faq.shtml> Does anyone know if I can do this? Regards, SP. In article <ee98ff5.-1@webcrossing.caR9absDaxw>, StregaItalia@officeformac.com wrote: > Version: 2008 > Operating System: Mac OS X 10.4 (Tiger) > Processor: intel > > Hi, > > I'm thinking of buying Mac: Of...

Disabling Copy
I have an excel sheet which is protected. When i right click on a cell it can allow me to copy the contents. How can i make the copy to be disabled? Any one out there with an idea? Thanks -- pkrono ------------------------------------------------------------------------ pkrono's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=19532 View this thread: http://www.excelforum.com/showthread.php?threadid=346874 You can do this with Excel 2002/2003. With code you could disable a right-click, but you could still use Edit->Copy in Excel 2000 and earlier. "pk...

charting data with multiple series
I have a data set in this format: Temp Pressure Mass=115 2.2 897 4.1 752 6.3 631 8.5 555 Mass=125 1.3 999 4.6 888 8.9 777 9.6 600 Mass=130 3.6 987 4.5 876 6.9 654 8.0 555 and so on... Using an XY Scatter Graph, I want to plot Temp vs. Pressure for each data series. I want the labels in the left column to show up in the legend. Any suggestions on how to select the data? Thanks, Mary [This follo...

Run macro automatically.
How do I make a macro run automatically when a worksheet it is attached to is loaded? right click on the sheet tab>view code>left window worksheet>right window activate -- Don Guillett SalesAid Software donaldb@281.com "Excel macro" <Excel macro@discussions.microsoft.com> wrote in message news:DD7AF1E3-9263-4523-AC49-A43ABA1AB9D0@microsoft.com... > How do I make a macro run automatically when a worksheet it is attached to is > loaded? I am unable to find "activate " when I right click on worksheet. ( i assume that you are referring to the windo...

Help with macro/and or formula?
Perhaps this is a silly question, but i just can't figure out how t format this worksheet. The problem is that a lot of the cells hav numbers in them with negative signs in the back instead of in the fron (ie. 23-) and i was wondering if anyone knew of a macro/formula i coul use to quickly fix this problem for all the cells. I would b extremely grateful. Thanks -- brefed1 ----------------------------------------------------------------------- brefed15's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=3557 View this thread: http://www.excelforum.com/showthre...

Attached Toolbars Macros
Excel 2003 I have a custom tool bar, this tool bar has several items, each item is pointing to a VBA code. This tool bar is attached to the worksheet. I've copied this spreadsheet to several computers. After I copied the spreadsheet I decided to rename the spreadsheet, after I renamed the spreadsheet the Toolbar Item's macros were still pointing to the old name, I reasigned each tool bar item to the current spreadsheet, saved the spreadsheet and everything was working on my computer, but when I re-copied the new spreadsheet to other computers and I clicked on the Toolbar Item...

How to make worksheet name as variable?
In my workbook, some formulas are like this: =SUMPRODUCT(($E2<'sheet01'!$G$1:$G$500)*($F2>'sheet01'!$G$1:$G$500)*($C2='sheet01'!$E$1:$E$500)*($B2='sheet01'!$F$1:$F$500),'sheet01'!$J$1:$J$500) 'sheet01' is the name of one of my worksheets. It appears several time in the worksheet. When I want to make them refer to another worksheet, I have to change many instances of the name. Can I input the worksheet name into one of the cells, and the formulas get the name from the cell, so that I just have to change it once? Thanks in advance!! ...

Protected sheets and running macros
i have a sheet with a macro ran by a normal button at the top. Howeve when i protect the worksheet where ever i click on the sheet the macr executes. Can any one offer any advice on how to stop this? Thanks Robert -- Message posted from http://www.ExcelForum.com hi, i am not able to reproduce the problem, hence i may not be able t provide a panacea for that issue. here is what i suggest. i have a sheet that has a macro that is run when a control toolbo button (that is, not a form button) is clicked. this sheet is protected based on the user logged in. what i have don is to protect t...

Copy picture from word 2003 to word 2007
When I copy a document with a picture from 2003 to 2007 the picture ends up with what looks like a bunch of lines - horizontal. Any way to get rid of this? Your best bet would be to right click the picture in your 2003 document and save the picture to your computer. After this is completed, open Word 2007 and click insert picture. Now browse your computer and find that picture you saved. I'm surprised this happened, but I'm guessing its a compatibility issue between 2003 and 2007. "Daisy" wrote: > When I copy a document with a picture from 2003 to 2007...

Macro Freezes Reading Pane
I have a macro that Sends/Receives Tasks from Project Server into Outlook Tasks. Everything is working fine, except one weird thing that happens. I have the Timer set on the macro and it starts as soon as Outlook starts. The macro gets the tasks from ProjectServer every hour. As soon as the macro starts running the Reading pane freezes in the Inbox. If i stop the macro then Reading pane is back to normal. Can anyone please tell me if there is something I can do in VBA to fix this annoying issue. Thanks a lot ...

Macro to remove rows?
Hi, I receive thousands of rows of data from an extract that comes from a database. The data extract automatically generates page headers that need to be removed, and I would love to automate this process. The headers do have a pattern to them, but I'm not clever enough to figure out a good way to use that to write a macro. The first row of the header starts with hyphens ------------------------------- Then there's a variable number of rows of header data to delete followed by another row of hyphens ------------------------------- Then 2 additional rows that must be deleted. The nu...

Calling on a macro within a macro!
Hey All!! Quick Question - How do you call up a macro within a current macro? I have one big macro and I need it to jump to several other macros when it runs! Does it matter where the other macros are stored or is it better to have them all in one module? Help appreciated Thnx! Hi Mellowe, '=============>> Public Sub Main() 'Your code Call One 'your code End Sub '<<============= '=============>> Public Sub One() MsgBox "Hi from One" End Sub '<<============= > Does it matter where the other macros are stored or ...

Can an item you have purchased in the past become a BOM?
We are currently purchasing an item from a vendor (PO history, order history etc) that we are planning on manufacturing ourselves in the next month. I've been tasked to see if there will be any issues with using the same part number we currently ORDER from a vendor to change it into a BOM in the future. I've tested this out in our test company and cannot find any reason why we cannot use the same part number - we simply would not be able to ORDER that part any longer from anyone. Has anyone else ever gone through this process before? any issues? OR is it better to give this i...

Linking data to another spreadsheet on an FTP server
Hi I'm trying to manage a set of spreadsheets that are updated by a numbe of different users in different geographical locations. One of th worksheets contains data that needs to be controlled centrally, bu used by each of the different versions of the spreadshee (incidentally, there are 4 versions). The worksheet that contains this data currently resides on an FT server and I would like the worksheet within each of the versions t read the data from the central copy on the FTP server. I've tried to do this by creating a web query and linking it directl to the spreadsheet (includi...

copying from worksheets
I have a file containing a number of different worksheets. The first worksheet is a summary. The other worksheets are named individuals onto a calender. The summary shows what they did each week. I need to copy each individuals detail from the cells in the summary onto their own page, as it is entered. Saves me time copying. Is it possible. For example i dont need Mr Smiths details on Mr Jomnes individual sheet. Mal You might be interested in what the Data > Filter > AutoFilter feature can do for you when applied to the Summary sheet............you can filter so that you see on...

Can i print copy numbers?
At my job we must print copies of databases and keep track of them. We only print 100 copies at a time. Is there a way to make it automaticly put "1 of 100" or "copy 1 of 100" in the footer?? You could run a little macro: Option Explicit Sub testme() Dim iCtr As Long For iCtr = 1 To 3 '100 when you're ready With ActiveSheet .PageSetup.RightFooter = "Copy " & iCtr & " of 100" .PrintOut preview:=True 'false when you're ready End With Next iCtr End Sub I used 1 to 3 and pri...

Trend Line constants as Excel Cell Values
I want to put the constants of a 2 degree polynomial trend line into Excel Cells. Are there formula's to do this? Equation is Y = Ax(2) + Bx + C. I want the value of A,B and C in seperate cells. Can anyone suggest how this can be done? Thanks -- Ken Hi Ken, Supposing your x-range is in A2:A10, and y-range in B2:B10, select a 3-column x 1-row area and enter the following formula and confirm with CTRL-SHIFT-ENTER. =LINEST(B2:B10,A2:A10^{0,1,2},0,) Regards, B. R. Ramachandran "Ken" wrote: > I want to put the constants of a 2 degree polynomial trend line into Excel &g...

shortcut keys to macros
Hi, Is it at all possible to assign shortcut keys to macros in Outlook? Thx, Hans ...

help Unable to record Macro !!!!!!!
I want to record a macro in excel.But as soon as I click record Macro it says "unable to record" macro. Got no help in excel help.I do this same thing in word and it's working. Please help It's urgent for me !!!1 Have a look here http://groups.google.com/groups?as_epq=unable%20to%20record&as_ugroup=microsoft.public.excel.* -- Don Guillett SalesAid Software donaldb@281.com "ash" <anonymous@discussions.microsoft.com> wrote in message news:3e0b01c42ae5$45333e00$a401280a@phx.gbl... > I want to record a macro in excel.But as soon as I click > record...