Thread: row selecting
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Sheeloo[_2_] Sheeloo[_2_] is offline
external usenet poster
 
Posts: 364
Default row selecting

Try this macro... read the rows marked with '

Sub CopyToSheet()

'You will need to run this after entering the value in cell A1 of Sheet1
'Row with number in Col H equal to the number in cell A1 of sheet1
'will be copied to row 1 of Sheet2

'Cell Sheet1!A1 must contain a number otherwise this macro will fail

Dim myrange As Range
Dim LastRow As Long
Dim c
Dim i As Integer
Sheets("Sheet1").Activate
i = Cells(1, 1).Value
LastRow = Cells(Rows.Count, "H").End(xlUp).Row
Set myrange = Range("H1:H" & LastRow)
For Each c In myrange
If c.Value = i Then
Cells(i, 1).EntireRow.Copy
Sheets("Sheet2").Activate
Cells(1, 1).Select
ActiveSheet.Paste
MsgBox "Row " & i & " copied to Sheet1 Row 1"
Exit For
End If
Next c
End Sub


"climate" wrote:

Hi
I have a matrix (1000 * 60), and column H is numbered 1 to 1000 irregularly.
I want to try copy and extract row for example number700 to sheet2 when i
select number of that row.in fact when i enter number of any rows, a formula
or macro copy entire of its row to sheet2.
Thank's and regards