Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default 1 Create a macro to Copy & paste certain data to another sheet

I have no experience with macros @ all. Really need your help.
I have a spreedsheet that I sort by column A, depending on what code is in
column A, I need the data adjacent to it copied to another sheet.


Example: SHEET "OPEN"
COLUMN A COLUMN B COLUMN C COLUMN D
09 $25,000 ABC VENDOR 11/2/08
13 $55.00 XYZ VENDOR 10/19/08

IF COLUMN A ON WORKSHEET "OPEN" IS = 09 THEN I NEED EVERYTHING IN THE ROW
ADJACENT TO IT (COLUMN B THRU D) COPIED TO SHEET "SMITH". CAN ANYONE HELP ME.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,805
Default 1 Create a macro to Copy & paste certain data to another sheet

I wrote a similar macro yesterday for another post..

Open the workbook
Press ALT-11 to open VB Editor
Click on your workbook name on the left
Click on Insert-Module
Paste the code below
Press the PLAY button on the top

Go to your workbook and verify

Sub copyit()
'IF COLUMN A ON WORKSHEET "OPEN" IS = 09 THEN I NEED EVERYTHING IN THE ROW
'ADJACENT TO IT (COLUMN B THRU D) COPIED TO SHEET "SMITH".

Dim shName As String
Dim MyRange As Range
Dim sh As Worksheet

Set MyRange = Worksheets("Open").Range("A1:A" &
Worksheets("Open").Cells(Rows.Count, "A").End(xlUp).Row)

For Each c In MyRange
'If Col A contains numbers then replace "09" with 9 below
If c.Value = "09" Then

c.EntireRow.Copy _
Destination:=Sheets("Smith").Cells(Sheets("Smith") .Cells(Rows.Count,
"A").End(xlUp).Row + 1, 1)
End If

Next
End Sub

"Lin1981" wrote:

I have no experience with macros @ all. Really need your help.
I have a spreedsheet that I sort by column A, depending on what code is in
column A, I need the data adjacent to it copied to another sheet.


Example: SHEET "OPEN"
COLUMN A COLUMN B COLUMN C COLUMN D
09 $25,000 ABC VENDOR 11/2/08
13 $55.00 XYZ VENDOR 10/19/08

IF COLUMN A ON WORKSHEET "OPEN" IS = 09 THEN I NEED EVERYTHING IN THE ROW
ADJACENT TO IT (COLUMN B THRU D) COPIED TO SHEET "SMITH". CAN ANYONE HELP ME.

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
Macro - copy a range and paste it in a new sheet 12 times Eva Excel Worksheet Functions 0 September 26th 07 07:20 PM
how to create a copy/paste special/transpose macro? [email protected] Excel Discussion (Misc queries) 6 August 8th 07 06:07 AM
How to create a macro which performs a copy-and-paste task every 5mins after data is refreshed from web page? ­»´ä®a©~¸Ë­× Excel Worksheet Functions 0 December 5th 06 08:57 AM
Copy and Paste Macro for front totals sheet [email protected] Excel Discussion (Misc queries) 0 May 5th 06 05:12 PM
I need formula help or create a macro to copy and paste value only Rebecca Excel Discussion (Misc queries) 4 April 8th 06 01:18 PM


All times are GMT +1. The time now is 07:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"