Help copying info down to last line on sheet.

Kirnon

Board Regular
Joined
Apr 23, 2008
Messages
110
Using a solution for another column I tried to fill in some detail for a sheet that gets thrown into excel. The code is as follows.
Code:
Sub Test()
    Columns("H:I").Insert Shift:=xlToLeft
    With Range("A1").CurrentRegion.Columns(1)
        .Offset(RowCount, 7).Value = "Pay"
        .Offset(RowCount, 8).Value = "Basic"
        .Offset(RowCount + 1, 7).Value = "Pay"
        .Offset(RowCount + 1, 8).Value = "Day Rate"
        .Offset(RowCount + 2, 7).Value = "Overtime"
        .Offset(RowCount + 2, 8).Value = "O/T 1.5"
        .Offset(RowCount + 3, 7).Value = "Holiday"
        .Offset(RowCount + 3, 8).Value = "Hol Pay"
        .Offset(RowCount + 4, 7).Value = "Holiday"
        .Offset(RowCount + 4, 8).Value = "Bnk Hol Pay"
        .Offset(RowCount + 5, 7).Value = "RD Work"
        .Offset(RowCount + 5, 8).Value = "Mon-Fri"
        .Offset(RowCount + 6, 7).Value = "RD Work"
        .Offset(RowCount + 6, 8).Value = "Sat"
        .Offset(RowCount + 7, 7).Value = "RD Work"
        .Offset(RowCount + 7, 8).Value = "Sun"
        .Offset(RowCount + 8, 7).Value = "Crooklands"
        .Offset(RowCount + 8, 8).Value = "RD Prem"
        .Offset(RowCount + 9, 7).Value = "Crooklands"
        .Offset(RowCount + 9, 8).Value = "Night Prem"
        .Offset(RowCount + 10, 7).Value = "Other"
        .Offset(RowCount + 10, 8).Value = "Bulk"
        .Offset(RowCount + 11, 7).Value = "Sick"
        .Offset(RowCount + 11, 8).Value = "Comp Sick"
        .Offset(RowCount + 12, 7).Value = "Sick"
        .Offset(RowCount + 12, 8).Value = "SSP"
        .Offset(RowCount + 13, 7).Value = "Sick"
        .Offset(RowCount + 13, 8).Value = "SPP"
    End With
End Sub

The problem with this particular code is that it continues down my data and only copies the last line ie. "SPP" instead of looping through like I thought it would.

I picked the "With Range("A1").CurrentRegion.Columns(1)" from a solution provided by Fazza to another user.

As I said it works for my other info which is simply copying a formula down but not here.

Can anybody help me?
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Kirnon

Could you explain in words just what you want the code to do?
 
Upvote 0
Hi,

I have an exported Pay information sheet which comes out without headings or labels of any kind and with terrible formatting.

I have worked out a bunch of code transposing numbers etc. to get it formatted for placing into a Pivot (Much of that code gleaned from these very boards). I am now attempting to put labels onto the information the code that I have included in my first post puts those labels into the correct columns and rows for the first individual.

The idea being that the next row down from the last offset should loop the code so that it once more starts with the first offset. this needs to continue till the last row of information. Currently - After completing all the Offset once correctly the code then continues on repeating the last row till the end of my data.

I hope that is clear.

Thanks for the quick reply.
 
Upvote 0

Forum statistics

Threads
1,214,863
Messages
6,121,978
Members
449,058
Latest member
oculus

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