copies blank cell. screws up layout of rows

hopr37

Board Regular
Joined
Apr 16, 2018
Messages
76
2 worksheets
worksheet 1 is for entering data
worksheet 2 makes a copy of certain rows of data from worksheet 1 ( depending if a value was added to a certain row from worksheet 1)

worksheet 1:

[TABLE="width: 500"]
<tbody>[TR]
[TD]Value 1[/TD]
[TD]Value 1[/TD]
[TD]Value 1[/TD]
[/TR]
[TR]
[TD]Blank[/TD]
[TD]Value 2[/TD]
[TD]Value 2[/TD]
[/TR]
[TR]
[TD]Value 3[/TD]
[TD]Value 3[/TD]
[TD]Value 3[/TD]
[/TR]
</tbody>[/TABLE]

So....
Whenever I change a value in the center column, it copies the values of that entire row.
Change value 1 in center column copies first, center and last row to different worksheet. That works great.
Change value 3 in center column copies first,center and last row to a different worksheet just underneath the previous column...that works great.
Now... If I were to change the value in the center column of value 2 AND the first column is blank, it still copies over to a different worksheet. However,
since there is no data in the first row it leaves it blank. The problem is, if I were to change another value in a different center column it moves the entire first row up while leaving the other rows in place thus causing everything to be off . ( Essentially, it would move value 3 up to the blank spot)

Any idea how I can avoid this?
 
Last edited:
If you ran the code I supplied in post#15 & then ran the mod I suggested in post#4 the data would have been copied to row 5.
If it isn't, then you have something else happening.
 
Upvote 0

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I redid it and yes, It does put everything where it should start out. However, the issue hasn't changed.
If row c has a blank and you make another change, it pushes the second and third row up one row.

this is my original rows and columns

[TABLE="width: 500"]
<tbody>[TR]
[TD]description[/TD]
[TD]number 1[/TD]
[TD]number 2[/TD]
[/TR]
[TR]
[TD]BLANK[/TD]
[TD]number 3[/TD]
[TD]number 4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


So if I change the center column ( number 1), it copies row 1,2 and 3 to the "RunningTotal" worksheet. ( description, number 1, number 2)

THEN let's say I change the second row in the center column from number 3 to number 66. It copies the second row to the next row on the "RunningTotal" worksheet. ( BLANK, number 66, number 4
[TABLE="width: 500"]
<tbody>[TR]
[TD]description[/TD]
[TD]number 1[/TD]
[TD]number 2[/TD]
[/TR]
[TR]
[TD]BLANK[/TD]
[TD]number 66[/TD]
[TD]number 4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

NOW. let's say I change the first row again. This time from number 1 to say number 22. This is what happens
[TABLE="width: 500"]
<tbody>[TR]
[TD]description[/TD]
[TD]number 1[/TD]
[TD]number 2[/TD]
[/TR]
[TR]
[TD]description[/TD]
[TD]number 66[/TD]
[TD]number 4[/TD]
[/TR]
[TR]
[TD]BLANK[/TD]
[TD]number 22[/TD]
[TD]number 2[/TD]
[/TR]
</tbody>[/TABLE]

see how number 66 and number 4 jump up instead of keeping it : BLANK, number 66, number 4.

This is how it should look
[TABLE="width: 500"]
<tbody>[TR]
[TD]description[/TD]
[TD]number 1[/TD]
[TD]number 2[/TD]
[/TR]
[TR]
[TD]BLANK[/TD]
[TD]number 66[/TD]
[TD]number 4[/TD]
[/TR]
[TR]
[TD]description[/TD]
[TD]number 22[/TD]
[TD]number 2[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0
The code I supplied, does not do that. In fact it would overwrite your data all the time because I made a small mistake. Try this
Code:
Dim Nxtrw As Long
   Application.ScreenUpdating = False

   If Not Intersect(Target, Range("D:D")) Is Nothing Then
      Nxtrw = Sheets("RunningTotal").Range("C:E").Find("*", , xlValues, , xlRows, xlPrevious, , , False)[COLOR=#ff0000].Offset(1)[/COLOR].Row
      
      Sheets("RunningTotal").Range("C" & Nxtrw).Value = Sheets("Copper").Range("A" & Target.Row).Value 'copies column A from "Copper" to C4 of "Running Total"
      Sheets("RunningTotal").Range("D" & Nxtrw).Value = Sheets("Copper").Range("D" & Target.Row).Value 'copies column D from "copper" to D4 of "Running Total"
      Sheets("RunningTotal").Range("E" & Nxtrw).Value = Sheets("Copper").Range("F" & Target.Row).Value ' copies column F from "copper to column E4 of "Running Total"
   End If
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,711
Messages
6,174,025
Members
452,542
Latest member
Bricklin

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