Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I want to use the below code to copy an entire row to a new sheet when a = true. Can anyone help ! Sub YTD_Modifer() r = 2 a = "1st Quarter Quarter" Do Until Sheets("Data").Cells(r, 2) = "" r = r + 1 If Sheets("Data").Cells(r, 2) a Then copy entire row to a new sheet End If Loop End Sub Many thanks Marcus |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub test()
Dim i As Long, rng As Range, str As String str = "1st Quarter Quarter" Set rng = Worksheets("Sheet2").Rows(1) With Worksheets("Data") For i = 2 To .Cells(Rows.Count, 2).End(xlUp).Row If StrComp(.Cells(i, 2).Value, str) = 1 Then .Rows(i).Copy rng Set rng = rng.Offset(1) End If Next End With End Sub -- Rob van Gelder - http://www.vangelder.co.nz/excel "Marcus" wrote in message ... Hi I want to use the below code to copy an entire row to a new sheet when a = true. Can anyone help ! Sub YTD_Modifer() r = 2 a = "1st Quarter Quarter" Do Until Sheets("Data").Cells(r, 2) = "" r = r + 1 If Sheets("Data").Cells(r, 2) a Then copy entire row to a new sheet End If Loop End Sub Many thanks Marcus |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need this code to work with < commands is this possible
-----Original Message----- Sub test() Dim i As Long, rng As Range, str As String str = "1st Quarter Quarter" Set rng = Worksheets("Sheet2").Rows(1) With Worksheets("Data") For i = 2 To .Cells(Rows.Count, 2).End(xlUp).Row If StrComp(.Cells(i, 2).Value, str) = 1 Then .Rows(i).Copy rng Set rng = rng.Offset(1) End If Next End With End Sub -- Rob van Gelder - http://www.vangelder.co.nz/excel "Marcus" wrote in message ... Hi I want to use the below code to copy an entire row to a new sheet when a = true. Can anyone help ! Sub YTD_Modifer() r = 2 a = "1st Quarter Quarter" Do Until Sheets("Data").Cells(r, 2) = "" r = r + 1 If Sheets("Data").Cells(r, 2) a Then copy entire row to a new sheet End If Loop End Sub Many thanks Marcus . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
If statement to copy an entire row to other worksheet w/ in same b | Excel Worksheet Functions | |||
Copying/Linking Entire Workbook | Excel Discussion (Misc queries) | |||
copy an entire row IF a statement is true | Excel Worksheet Functions | |||
Copying entire worksheets | Excel Discussion (Misc queries) | |||
Macro for copying entire raw | Excel Programming |