changing a list by VBA

magpie2000k

Board Regular
Joined
Sep 13, 2013
Messages
196
I have a code written by Fluff

I have been asked to add something to it..

Basically I have it pulling accross the course names. If I have a list of course names saved on say sheet (course names).

I have column a course name on data tab and in column B the revised course name.

can I have it update the course name in the results with new course name

Here is the origonal code

Code:
Sub ReorganiseData()
   Dim r As Long, c As Long, i As Long, j As Long, k As Long
   Dim ary As Variant
   Dim Nary() As Variant
  
   ary = Sheets("data").Range("A1").CurrentRegion.Offset(1)
   j = 1
   For r = 1 To UBound(ary)
      For c = 3 To UBound(ary, 2) Step 5
         If Not ary(r, c + 1) = "-" Then
            ReDim Preserve Nary(1 To 7, 1 To j)
            Nary(1, j) = ary(r, 1)
            Nary(2, j) = ary(r, 2)
            For i = 3 To 7
               Nary(i, j) = ary(r, c + k)
               k = k + 1
            Next i
            j = j + 1: k = 0
         End If
      Next c
   Next r
   Sheets("Result").Range("A1:G1").Value = Array("Student", "Office", "Course", "Date Assigned", "Attepmts", "Pass Mark", "Date Achieved")
   Sheets("Result").Range("A2").Resize(j - 1, 7).Value = Application.Transpose(Nary)
End Sub



Thanks in advance
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,214,387
Messages
6,119,225
Members
448,877
Latest member
gb24

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