PDA

View Full Version : [SOLVED] VBA code chages - pick two cell instead of 1



shido
02-23-2015, 07:15 AM
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

p45cal
02-24-2015, 12:55 PM
This is really a sequel of the thread at http://www.vbaexpress.com/forum/showthread.php?51814-Help-to-modify-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)

shido
02-24-2015, 01:52 PM
Hi P45scal,

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

You save my day..

Regard

Sha