View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Copy row to sheet as per dropdown

Kashya, you can also avoid the loop..

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Column = 8 Then
strSName = Cells(Target.Row, 8)
lngLastRow = ActiveWorkbook.Sheets(strSName).Cells(Rows.Count,
"A").End(xlUp).Row
arrTemp = ActiveSheet.Range("A" & Target.Row & ":G" & Target.Row)
ActiveSheet.Range("A" & lngLastRow & ":G" & lngLastRow) = arrTemp
End If
End Sub

--
If this post helps click Yes
---------------
Jacob Skaria


"Kashyap" wrote:

Hi, I have dropdown in ColH with all the names similar to sheet names. When I
select a name from dropdown macro should copy that row from A:G and paste the
same at A2 & xdown as per the sheet selected.