Consulting

Results 1 to 3 of 3

Thread: Solved: Repeat Column Insertation (It's simple!)

  1. #1

    Solved: Repeat Column Insertation (It's simple!)

    Hi guys

    It's late, I'm tired and I know this is a simple one, but could someone please help me sort this out.

    [VBA]' InsertKYC Macro
    '
    Dim j As Integer

    Dim range As Integer
    For j = to Sheets ("Input KYC Sheet")Range("D247").


    Sheets("KYC Checklist").Select
    Rows("19:19").Select
    Selection.Copy
    Selection.Insert Shift:=xlDown
    Next j
    End Sub[/VBA]

    All I'm trying to do is to get it to copy and insert Row 19 on the KYC Checklist sheet the number of times that the Input KYC Sheet has in cell D247.

    I can't get it to recognise the range....

    I know this isn't difficult but my brain is fried and i can't take VBA yelling "expected bracket or expression" at me anymore.

    Thanks

    Phel x

  2. #2
    VBAX Mentor MaximS's Avatar
    Joined
    Sep 2008
    Location
    Stoke-On-Trent
    Posts
    360
    Location
    try that:

    [vba]
    Dim i, j As Integer

    With Worksheets("Input KYC Sheet")

    j = .Range("D247").Value

    For i = 1 To j

    .Select
    .Rows("19:19").Select
    Selection.Copy
    Selection.Insert Shift:=xlDown
    Next j

    End With
    End Sub
    [/vba]
    Last edited by MaximS; 04-20-2009 at 09:25 AM.

  3. #3
    A couple of minor changes but thank you so much for coming up with the right code. My poor old head couldn't take much more!

    Ended up with

    [VBA]'
    Dim i, j As Integer

    With Worksheets("Input KYC Sheet")

    j = .range("D247").Value

    For i = 1 To j

    Sheets("KYC Checklist").Select
    Rows("19:19").Select
    Selection.Copy
    Selection.Insert Shift:=xlDown
    Next i

    End With
    End Sub[/VBA]

    Thanks for the help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •