ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Dependent On Cell Value (https://www.excelbanter.com/excel-programming/428685-copy-dependent-cell-value.html)

Timbo[_14_]

Copy Dependent On Cell Value
 

I have data on Sheet1 Range A5:E25, A contains text B:E contains
values.

I want to copy the data from Sheet1 to Sheet 2 dependent on the text in
Sheet 1 Column A.

Example:

If A5 on Sheet 1 is < than "Other Publisher Groups" I want to copy
A5:E5 to Sheet 2 cell B4:F4.

If A5 on Sheet 1 is ="Other Publisher Groups" I want to drop down a row
and copy A6:E6 to Sheet 2 cell B4:F4.

In short If the value in A is < to "Other Publisher Groups" I want to
copy

Sheet1 A5:E5 to Sheet 2 B4:F4 Then
Sheet1 A6:E6 to Sheet 2 B5:F5
Sheet1 A7:E7 to Sheet 2 B6:F6

If Sheet1 A8 = "Other Publisher Groups" I would jump a row i.e.

Sheet1 A9:E9 to Sheet 2 B7:F7

Hope that makes sense.


--
Timbo
------------------------------------------------------------------------
Timbo's Profile: http://www.thecodecage.com/forumz/member.php?userid=24
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=98084


joel

Copy Dependent On Cell Value
 
I think you just want to copy rows that don't havve "Other Publisher Groups"

Sub movedata()

DestRow = 4
With Sheets("Sheet1")
RowCount = 4
Do While .Range("A" & RowCount) < ""
If .Range("A" & RowCount) < "Other Publisher Groups" Then
.Range("A" & RowCount & ":E" & RowCount).Copy _
Destination:=Sheets("Sheet2").Range("B" & DestRow)
DestRow = DestRow + 1
End If
RowCount = RowCount + 1
Loop

End With

End Sub

"Timbo" wrote:


I have data on Sheet1 Range A5:E25, A contains text B:E contains
values.

I want to copy the data from Sheet1 to Sheet 2 dependent on the text in
Sheet 1 Column A.

Example:

If A5 on Sheet 1 is < than "Other Publisher Groups" I want to copy
A5:E5 to Sheet 2 cell B4:F4.

If A5 on Sheet 1 is ="Other Publisher Groups" I want to drop down a row
and copy A6:E6 to Sheet 2 cell B4:F4.

In short If the value in A is < to "Other Publisher Groups" I want to
copy

Sheet1 A5:E5 to Sheet 2 B4:F4 Then
Sheet1 A6:E6 to Sheet 2 B5:F5
Sheet1 A7:E7 to Sheet 2 B6:F6

If Sheet1 A8 = "Other Publisher Groups" I would jump a row i.e.

Sheet1 A9:E9 to Sheet 2 B7:F7

Hope that makes sense.


--
Timbo
------------------------------------------------------------------------
Timbo's Profile: http://www.thecodecage.com/forumz/member.php?userid=24
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=98084




All times are GMT +1. The time now is 05:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com