transfering information to another sheet

i8ig

Board Regular
Joined
Jul 17, 2007
Messages
122
Is there a simple macro to take all the information in a row and transfer it to another sheet based on a date in one of the columns?
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi
paste the following codes in the macro window (Alt F11)
Code:
sub list()
b = cells(1,1)
x= worksheets("sheet1").cells(rows.count,1).end(xlUp).row
c= 1
for a  = 1 to x
if cells(a,1) = b then
worksheets("sheet1").rows(a).copy
worksheets("sheet2").rows(c).pastespecial
c = c+1
endif
next a
end sub
enter the date in cell A1 and run the macro. It will copy all rows with given date in col A to sheet 2
Ravi
 
Upvote 0
Here is the macro that is already in the sheet. the date column is 'M' and the spread sheet is named by the month i.e. August, the next Sept. dates are entered as 8/02/07. My question is where should I insert this new macro and based on the above information do I need to change any of the parameters in the new macro?
Thanks
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then
    If Target.Value = "Med" Then
        Rows(Target.Row).Interior.ColorIndex = 4
        Cells(Target.Row, 10) = "=IF(RC[3]="""","""",RC[3]-3)"
    Else
        If Target.Value = "Tasc" Then
            Rows(Target.Row).Interior.ColorIndex = 6
            Cells(Target.Row, 10) = "=IF(RC[1]="""","""",RC[1]-2)"
            Cells(Target.Row, 11) = "=IF(RC[2]="""","""",RC[2])"
        Else
            If Target.Value = "Nbar" Then
                Rows(Target.Row).Interior.ColorIndex = x1ColorIndexNone
                Cells(Target.Row, 22) = "=IF(RC[-1]="""","""",RC[-1]+7)"
                Cells(Target.Row, 21) = "=IF(RC[-1]="""","""",RC[-1]+7)"
                Cells(Target.Row, 20) = "=IF(RC[-7]="""","""",RC[-7]+14)"
                Cells(Target.Row, 12) = "=IF(RC[1]="""","""",RC[1]-5)"
                Cells(Target.Row, 11) = "=IF(RC[1]="""","""",RC[1]-2)"
                Cells(Target.Row, 10) = "=IF(RC[1]="""","""",RC[1]-2)"
            Else
                Rows(Target.Row).Interior.ColorIndex = xlColorIndexNone
            End If
        End If
    End If
End If
End Sub
 
Upvote 0
Hi
Press Alt and F11 simultaneously. goto Insert menu and choose module. paste the codes given below in the window you get.
Code:
sub list() 
b = cells(1,1) 
x= worksheets("sheet1").cells(rows.count,13).end(xlUp).row 
c= 1 
for a  = 1 to x 
if cells(a,13) = b then 
worksheets("sheet1").rows(a).copy 
worksheets("sheet2").rows(c).pastespecial 
c = c+1 
endif 
next a 
end sub
change sheet1 to sheet where you want searched say aug or sep. change sheet2 to sheet name where you want the data pasted. run the macro.
Ravi
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,484
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top