Shift Data to a Specified Row

rwmill9716

Active Member
Joined
May 20, 2006
Messages
485
Office Version
  1. 2013
Platform
  1. Windows
BarryL provided me the start to the building the following Code. Essentially, it copies the data in columns C & D to columns G & H. It then reads the row shift factor in cell F5, and copies the data in columns E & F into columns G & H beginning in the shifted row. The data in columns G & H are shown here as they should be: rows 8 through 12 contain data from E & F, while rows 13 through 28 contain data from C & D. When I actually run the macro, however, rows 8 through 12 contain the correct E & F data, but rows 13 through 28 are blank. I need to define the end row for columns E & F which only copies that data, as it stands now it's copying all the data in columns E & F (data an blank cells) into G & H.

Code:
Sub Shift_Salt_Data()


Range("C8:D500").Select   'Copy Date and Data Columns to Holding Columns
    Selection.Copy
    Range("G8").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False

Dim lr As Long, rowno As Long
Let lr = Range("E" & Rows.Count).End(xlUp).Row
Let rowno = Range("F5").Value
Range("E8:F" & lr).Copy
Range("G" & rowno).PasteSpecial xlPasteValues
Application.CutCopyMode = False

End Sub




Excel 2012
CDEFGH
4Shift Data to RowUpper Spec =56.5
58Lower Spec =55.5
6Ppk =0.53
7Date/Time405Rsse.PHDate/Time405Rssf.concDateComposite
81/1/2016 0:16:0056.409999851/1/2016 0:17:0056.352001191/1/16 0:1756.35
91/2/2016 0:10:0056.273998261/2/2016 0:10:0056.398998261/2/16 0:1056.40
101/2/2016 23:43:3556.124000551/2/2016 23:43:5856.254001621/2/16 23:4356.25
111/4/2016 0:03:0555.895000461/4/2016 0:03:2455.604000091/4/16 0:0355.60
121/5/2016 0:55:5056.050998691/5/2016 0:55:0056.066001891/5/16 0:5556.07
131/6/2016 0:20:5555.987998961/6/16 0:2055.99
141/8/2016 1:08:2355.978000641/8/16 1:0855.98
151/9/2016 0:23:0056.013999941/9/16 0:2356.01
161/10/2016 0:05:0055.826999661/10/16 0:0555.83
171/10/2016 23:03:1656.358001711/10/16 23:0356.36
181/11/2016 20:34:4756.050998691/11/16 20:3456.05
191/12/2016 19:12:2156.273998261/12/16 19:1256.27
201/13/2016 19:45:3156.377998351/13/16 19:4556.38
211/14/2016 19:25:3556.326000211/14/16 19:2556.33
221/15/2016 22:55:1356.33700181/15/16 22:5556.34
231/17/2016 0:37:1556.383998871/17/16 0:3756.38
241/17/2016 22:34:4956.352001191/17/16 22:3456.35
251/18/2016 21:49:5756.097999571/18/16 21:4956.10
261/19/2016 20:43:3756.112998961/19/16 20:4356.11
271/21/2016 0:15:0055.916000371/21/16 0:1555.92
281/21/2016 22:15:0056.154998781/21/16 22:1556.15
Test
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Seems like this should be an easy fix for someone that knows VBA, but I may be wrong.
 
Upvote 0

Forum statistics

Threads
1,203,690
Messages
6,056,753
Members
444,889
Latest member
ibbara

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