Consulting

Results 1 to 3 of 3

Thread: VBA code chages - pick two cell instead of 1

  1. #1

    VBA code chages - pick two cell instead of 1

    Hi All,

    I have the following code, which copy one cell from a workbook. I would like to change the code to pick two cell in the field highlighted in green Even after the changes, the code is only picking one cell and paste into a column and leaving the second column empty.

    Please see the code below

    Set DestnSht = Workbooks("Master Data.xls").Sheets("Master Data")
    With DestnSht
        Set DestnCell = .Cells(.Rows.Count, 1).End(xlUp).Offset(1)
      End With
      .Range("a7:h" & j).Copy DestnCell.Offset(, 2)
      With DestnCell.Resize(j - 6)
        .Value = data(8, 14)
    .Value = data (9,14)
        .Borders.LineStyle = xlContinuous
        .HorizontalAlignment = xlCenter
    I appreciate if you can help me & sorry if my explanation is too vague.

    Regards

    Sha
    Last edited by shido; 02-23-2015 at 07:27 AM.

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    This is really a sequel of the thread at http://www.vbaexpress.com/forum/show...odify-VBA-Code

    At a guess, because this involves an extra column (where should it go?) try amending to:


    With DestnSht
    Set DestnCell = .Cells(.Rows.Count, 1).End(xlUp).Offset(1)
    End With
    .Range("a7:h" & j).Copy DestnCell.Offset(, 2)
    With DestnCell.Resize(j - 6, 2)
    .Columns(1).Value = data(8, 14)
    .Columns(2).Value = data(9, 14)

    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    Hi P45scal,

    Thank you very much ... this is what i was looking for..

    You save my day..

    Regard

    Sha

Posting Permissions

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