0

I have an Excel workbook which contains an array of data.

I want to create test cases (Software testing) of another sheet by using the test data available in the first sheet.

So the final sheet will have the combination of sentence and the first sheet test data.

I'll put the sentence in but I need the basic skeleton code to go row by row and column by column to copy the data and paste.

Community
  • 1
  • 1
Prem
  • 37
  • 4
  • 10

1 Answers1

0

Well, there are already questions related to this on SO. For example, here is snippet shamelessly stolen from Copy data from another Workbook through VBA and freely adapted

Option Explicit
Sub test()
    Dim wb As Workbook

    'Set source workbook
    Set wb = ActiveWorkbook

    'For instance, copy data from a range in the first workbook to another range in the other workbook
    wb.Worksheets("Sheet2").Range("C3:D4").Value = wb.Worksheets("Sheet1").Range("A1:B2").Value
End Sub

The original answer was from user JMax

Community
  • 1
  • 1
yadutaf
  • 6,840
  • 1
  • 37
  • 48
  • Thanks for your reply. The code will copy all the ranges from c3 to D4 but i need the code which will loop through each cell, get the value and put in another sheet. which I'll be using to insert between some sentences.. for example If I have a value called "Computer" in Cell C3, i want this computer to be pasted in cell D6 of an another excel by appending a text "Computer is a great device" and also in cell D7 "Everything is computer". – Prem Aug 21 '12 at 18:09
  • You can access random cell value with wb.Worksheets("Sheet1").Range("A1").Value This is RW property so can do any operation on it – yadutaf Aug 21 '12 at 19:05