+ Reply to Thread
Results 1 to 3 of 3

macro to copy from one sheet and paste to another sheet defined by cell value

  1. #1
    Registered User
    Join Date
    12-22-2015
    Location
    Minnesota
    MS-Off Ver
    2007
    Posts
    3

    macro to copy from one sheet and paste to another sheet defined by cell value

    Hello, i have a macro that will print a specific worksheet based on the value of a cell in worsheet 1. I was curious as to how i would use the same general principal to copy a value from sheet 1 to the sheet specified by another cell value in sheet 1 to the next available row. Here is my printing macro:

    Sub PrintSAT()

    Dim sht As Worksheet


    For Each sht In ThisWorkbook.Worksheets
    If sht.Range("C5").Value = Sheet1.Range("B1") Then
    sht.PrintOut
    End If
    Next sht


    End Sub

    In this workbook, the value in (Cell "B1" worksheet1) will always match "Cell C5" in the desired destination worksheet.

    For example I would like to copy (sheet1 "Cell B4") and paste it into (next open row in "column I") of the worksheet that has a "C5" value equal to (Sheet1 "B1")'s value.

    Any info would be greatly appreciated.

    Thank you

  2. #2
    Registered User
    Join Date
    12-22-2015
    Location
    Minnesota
    MS-Off Ver
    2007
    Posts
    3

    Re: macro to copy from one sheet and paste to another sheet defined by cell value

    Basically saying assume (sheet1 cell b1 ="236"). I need to copy (sheet1 cell b4) and paste to next open row in column i of the worsheet that has a value of "236" in cell c5

    Hope that help ease some confusion...

  3. #3
    Registered User
    Join Date
    12-22-2015
    Location
    Minnesota
    MS-Off Ver
    2007
    Posts
    3

    Re: macro to copy from one sheet and paste to another sheet defined by cell value

    or am i overthinking this. would it work to just use a string of conditional statements such as something like this?


    if Sheets("sheet1").range("b1").value = "236" then
    Sheets("Sheet1").Range("B4").Copy
    Destination:=Sheets("Sheet2").Range("I" & Rows.Count).End(xlUp).Offset(1).Select

    And so on and so forth for each of my 19 sheets?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VBA - Macro issue copy/paste line other sheet + duplicate current sheet
    By vcourbiere in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-17-2014, 12:06 PM
  2. [SOLVED] Macro to copy a cell range and paste to a new sheet 'n' times where 'n' defined by formula
    By staminaboy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-26-2013, 11:39 AM
  3. Replies: 7
    Last Post: 12-03-2012, 03:10 AM
  4. Find value from sheet 1, cell A1 in sheet(s) 2 (3, 4?), copy, paste row to sheet 8
    By fleeting in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-27-2011, 03:31 PM
  5. Copy defined cell from various worksheets to new sheet (Index sheet)
    By kookao in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2011, 03:55 PM
  6. Replies: 2
    Last Post: 10-15-2009, 10:12 AM
  7. Macro to search the sheet name and copy and paste the data from a major sheet
    By salma2009 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-04-2009, 02:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1