Results 1 to 10 of 10

Thread: [RESOLVED] Excel Copy Whole Row to Different Sheet

  1. #1
    Hyperactive Member
    Join Date
    Dec 06
    Posts
    264

    Resolved [RESOLVED] Excel Copy Whole Row to Different Sheet

    Hi All

    Want to thank the help i got earlier. Its muchly appreciated

    Just one more :P

    Is it possible to copy a whole row of data to a different sheet on the next free line in that sheet?

    i hope this makes sense

    Thanks in advance

    Crampz

  2. #2
    Super Moderator koolsid's Avatar
    Join Date
    Feb 05
    Location
    Mumbai, India
    Posts
    11,449

    Re: Excel Copy Whole Row to Different Sheet

    Is it again related to hyperlink or a general question?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - Till Date IMP Links : Acceptable Use Policy, FAQ

    MyGear:
    Sony VGN-FZ27G with a triple boot between (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008) and (Win7+Office 2010+VS2010) || Sony VPCCB-45FN with a Win7+Office 2010+VS2010. VM: (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008), (Win8+Office 2010+VS2012) || Mac Book Pro (10.6.8) with Office 2011

  3. #3
    Hyperactive Member
    Join Date
    Dec 06
    Posts
    264

    Re: Excel Copy Whole Row to Different Sheet

    Quote Originally Posted by koolsid View Post
    Is it again related to hyperlink or a general question?
    Sorry. Yes again a hyperlink (if possible). On a different sheet now.

  4. #4
    Super Moderator koolsid's Avatar
    Join Date
    Feb 05
    Location
    Mumbai, India
    Posts
    11,449

    Re: Excel Copy Whole Row to Different Sheet

    Like this?

    Code:
    Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
        Dim lRow As Long
        
        If Range(Target.Range.Address).Column = 2 Then
            lRow = Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row + 1
            
            Target.Range.EntireRow.Copy Sheets("Sheet2").Rows(lRow)
        End If
    End Sub
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - Till Date IMP Links : Acceptable Use Policy, FAQ

    MyGear:
    Sony VGN-FZ27G with a triple boot between (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008) and (Win7+Office 2010+VS2010) || Sony VPCCB-45FN with a Win7+Office 2010+VS2010. VM: (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008), (Win8+Office 2010+VS2012) || Mac Book Pro (10.6.8) with Office 2011

  5. #5
    Hyperactive Member
    Join Date
    Dec 06
    Posts
    264

    Re: Excel Copy Whole Row to Different Sheet

    Quote Originally Posted by koolsid View Post
    Like this?

    Code:
    Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
        Dim lRow As Long
        
        If Range(Target.Range.Address).Column = 2 Then
            lRow = Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row + 1
            
            Target.Range.EntireRow.Copy Sheets("Sheet2").Rows(lRow)
        End If
    End Sub
    do you have another sample of it being used. i put the hyperlink in like last time. but no luck.

  6. #6
    Super Moderator koolsid's Avatar
    Join Date
    Feb 05
    Location
    Mumbai, India
    Posts
    11,449

    Re: Excel Copy Whole Row to Different Sheet

    Just replace the code with this code in the sample that I uploaded in your previous workbook.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - Till Date IMP Links : Acceptable Use Policy, FAQ

    MyGear:
    Sony VGN-FZ27G with a triple boot between (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008) and (Win7+Office 2010+VS2010) || Sony VPCCB-45FN with a Win7+Office 2010+VS2010. VM: (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008), (Win8+Office 2010+VS2012) || Mac Book Pro (10.6.8) with Office 2011

  7. #7
    Hyperactive Member
    Join Date
    Dec 06
    Posts
    264

    Re: Excel Copy Whole Row to Different Sheet

    Quote Originally Posted by koolsid View Post
    Just replace the code with this code in the sample that I uploaded in your previous workbook.
    Yep didnt realise that its copying the formula rather than the value. is it possible to get the value?

  8. #8
    Super Moderator koolsid's Avatar
    Join Date
    Feb 05
    Location
    Mumbai, India
    Posts
    11,449

    Re: Excel Copy Whole Row to Different Sheet

    Code:
    Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
        Dim lRow As Long
        
        If Range(Target.Range.Address).Column = 2 Then
            lRow = Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row + 1
            
            Target.Range.EntireRow.Copy
            Sheets("Sheet2").Rows(lRow).PasteSpecial xlValues
            
        End If
    End Sub
    or this

    Code:
    Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
        Dim lRow As Long
        
        If Range(Target.Range.Address).Column = 2 Then
            If Application.WorksheetFunction.CountA(Sheets("Sheet2").Columns(1)) = 0 Then
                lRow = 1
            Else
                lRow = Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row + 1
            End If
            
            Target.Range.EntireRow.Copy
            Sheets("Sheet2").Rows(lRow).PasteSpecial xlValues
        End If
    End Sub
    Last edited by koolsid; Jul 22nd, 2012 at 01:29 PM.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - Till Date IMP Links : Acceptable Use Policy, FAQ

    MyGear:
    Sony VGN-FZ27G with a triple boot between (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008) and (Win7+Office 2010+VS2010) || Sony VPCCB-45FN with a Win7+Office 2010+VS2010. VM: (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008), (Win8+Office 2010+VS2012) || Mac Book Pro (10.6.8) with Office 2011

  9. #9
    Hyperactive Member
    Join Date
    Dec 06
    Posts
    264

    Re: Excel Copy Whole Row to Different Sheet

    Quote Originally Posted by koolsid View Post
    Code:
    Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
        Dim lRow As Long
        
        If Range(Target.Range.Address).Column = 2 Then
            lRow = Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row + 1
            
            Target.Range.EntireRow.Copy
            Sheets("Sheet2").Rows(lRow).PasteSpecial xlValues
            
        End If
    End Sub
    Thank you ever so much. You have really helped me out alot today. I cannot thank you enough.

  10. #10
    Super Moderator koolsid's Avatar
    Join Date
    Feb 05
    Location
    Mumbai, India
    Posts
    11,449

    Re: [RESOLVED] Excel Copy Whole Row to Different Sheet

    You are welcome
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - Till Date IMP Links : Acceptable Use Policy, FAQ

    MyGear:
    Sony VGN-FZ27G with a triple boot between (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008) and (Win7+Office 2010+VS2010) || Sony VPCCB-45FN with a Win7+Office 2010+VS2010. VM: (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008), (Win8+Office 2010+VS2012) || Mac Book Pro (10.6.8) with Office 2011

Posting Permissions

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