+ Reply to Thread
Results 1 to 13 of 13

Thread: Calling Columns into different Worksheets

  1. #1
    Registered User
    Join Date
    01-10-2008
    Posts
    45

    Calling Columns into different Worksheets

    I'm not sure whether this should be a general question or it should go in the programming section... but here here goes anyways

    I need to create a spreadsheet where the contents of Col A & B in Sheet1 are copied into both Col A & B in Sheet2 & Sheet3. Sheet1 Col A&B will be continuously updated (rows will be added) and as these columns are updated, Col A & B in Sheet2 & Sheet3 should be updated automatically and keep the format that is set in Col A & B in Sheet1.

    Now, Col C&D in Sheet2 & 3 will be updated by a different user. As the user updates the cells in Col C&D in Sheet2 & 3, Col C&D in Sheet1 should automatically be updated with the data in the cells of Col C&D in Sheet2 (and keep the format) and Col E&F in Sheet1 should automatically be updated with the data in the cells of Col C&D in Sheet3 (and keep the format).

    Thanks!
    Attached Files Attached Files
    Last edited by BluTalon; 11-05-2008 at 11:42 AM.

  2. #2
    Registered User
    Join Date
    01-10-2008
    Posts
    45
    Bump - No Response

  3. #3
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,223
    You don't ever resort the data, do you? If not, standard relative references would suffice, wouldn't they?
    On Sheet2 cell A2 =Sheet1!A2
    Copy over one cell, then down as far as you want.

    Do the opposite for C/D and E/F.
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    01-10-2008
    Posts
    45
    I tired that, but when I do relative references to Sheet2 it doesn't keep the formatting from Sheet1. Any ideas on how the formatting can be kept?

  5. #5
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,223
    I would set my formatting ahead of time myself one time going down as far as I think I need it for this sheet. If it's a repetitive format, or alternating, once you've done a set that looks right, use the Format Painter to paint the formatting settings into the cells below in the same pattern. Quick and easy.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  6. #6
    Registered User
    Join Date
    01-10-2008
    Posts
    45
    The thing is that there is no real repetitive pattern for the formatting. There will be a header that will be in bold black, then the rows below that will vary on the amount of data for that particular batch. Once that batch is done, another header row will be added below that with a varying amount of rows below that.

    The person editing Sheet2 will not be allowed to edit Sheet1, but the formatting will have a certain significance for the person looking at Sheet1. If the text is red in Sheet2, it will mean that that cell is not ready for the person looking at Sheet1. Does that kind of make sense?

  7. #7
    Forum Guru
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2003
    Posts
    2,288
    As far as I know, you can't move formats without code, hence:

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    Application.EnableEvents = False
        Select Case Sh.Name
        Case "Sheet1"
            If Target.Column < 3 Then
                Sheets(Sh.Name).Columns("A:B").Copy Sheets("Sheet2").Columns("A:B")
                Sheets(Sh.Name).Columns("A:B").Copy Sheets("Sheet3").Columns("A:B")
            End If
        Case "Sheet2"
            If Target.Column = 3 Or Target.Column = 4 Then Sheets(Sh.Name).Columns("C:D").Copy Sheets("Sheet1").Columns("C:D")
        Case "Sheet3"
            If Target.Column = 3 Or Target.Column = 4 Then Sheets(Sh.Name).Columns("C:D").Copy Sheets("Sheet1").Columns("E:F")
        End Select
    Application.EnableEvents = True
    End Sub
    Fairly basic but it does the job.

    HTH
    Last edited by Cheeky Charlie; 11-07-2008 at 09:38 AM. Reason: oops

  8. #8
    Registered User
    Join Date
    01-10-2008
    Posts
    45
    Thank you! It works great.

  9. #9
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,223
    Shouldn't that last bit of code copy from Sheet 3 C/D to Sheet 1 E/F?
    Case "Sheet3"
            If Target.Column = 3 Or Target.Column = 4 Then Sheets(Sh.Name).Columns("C:D").Copy Sheets("Sheet1").Columns("E:F")
        End Select
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  10. #10
    Forum Guru
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2003
    Posts
    2,288
    Shouldn't that last bit of code copy from Sheet 3 C/D to Sheet 1 E/F?
    That's exactly what it does do (?)

    have a look at the help file for copy method, basically it comes down to:
    (item).copy (destination)

    CC

  11. #11
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,223
    Because the three things he needed to happen were:
    1. Two columns from Sheet1 copied to 2 & 3 (OK)
    2. Two columns from Sheet2 copied to Sheet1 (OK)
    3. Two columns from Sheet3 copied to Sheet1 (seems to be missing)
    That last line of code in CASE3, both destinations should be Sheet1 and to my mind, the 2nd reads as Sheet2 as the destination.

    Am I reading it wrong?

        Case "Sheet2"
            If Target.Column = 3 Or Target.Column = 4 Then Sheets(Sh.Name).Columns("C:D").Copy Sheets("Sheet1").Columns("C:D")
        Case "Sheet3"
            If Target.Column = 3 Or Target.Column = 4 Then Sheets(Sh.Name).Columns("C:D").Copy Sheets("Sheet2").Columns("E:F")
    Last edited by VBA Noob; 11-07-2008 at 08:25 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  12. #12
    Forum Guru
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2003
    Posts
    2,288
    oh... um... no

    oops

    (original code revised rather than entire repost)

  13. #13
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,223
    Thank God! I don't program at the level you guys do, so I am desperately trying to teach myself/understand the advanced stuff you guys post...so I'm glad I'm able to decipher some of it properly. Hehe.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0