VBA to move

dsin73

New Member
Joined
Mar 27, 2018
Messages
6
Good afternoon.

I have a single Row A1:TT1 with data I have imported from an API output.

The data looks similar to this and I import it using a comma delimiter

[{"instructorEmail":"jby@xyz.com","instructorUserId":"123","timeZoneName":"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris","startDate":"10/01/2018 9:00 AM","startDateUtcOffsetMinutes":120,"endDate":"10/02/2018 6:00 PM","endDateUtcOffsetMinutes":120,"status":"has not started","name":"11 FR, Paris Time October 1-2, 2018","shortId":"ygg2","studentLoginUrl":"https://xyz.com/Class/ygg2","id":"abc"},

{"instructorEmail":"sc@xyz.com","instructorUserId":"456","timeZoneName":"(UTC-05:00) Eastern Time (US & Canada)","startDate":"10/04/2018 6:00 AM","startDateUtcOffsetMinutes":-240,"endDate":"10/05/2018 8:00 PM","endDateUtcOffsetMinutes":-240,"status":"has not started","name":"Class Y October 4-5, 2018","shortId":"w56t0","studentLoginUrl":"https://xyz/Class/w56t0","id":"def"},]

I am tying to write a method which splits each course onto a seperate Row in Excel by searching for the like {*instructorEmail and moving the data until it finds the next {*instructorEmail to the next available Row Down in a loop

My end game is have a way where the instructor will select his course from the list and the macro will move his fields across to another worksheet where the output will be used for creating an email to the students. I.e class A starts on day B and the url to join the class is C but as I am unable to crawl I don't think I am ready to start this marathon just yet.


My very basic code so far. Sorry I am a real Excel VBA baby


Sub CommandButton1_Click()
Dim itemNumber As String
Dim itemAmount As Single
Dim myData As Workbook
Dim Wk As Worksheet
Dim Cel As Range



Set myData = Workbooks.Open("C:\Users\xyz\Desktop\classes.csv")
Set Wk = myData.Worksheets("classes")

For Each Cel In Wk.Range("A1:TT1")
'For Each Cel In Wk.Rows(1)
'{"instructorEmail":"me@me.co.uk"
If Cel.Value Like "*instructorEmail*" Then
'Cel.Value = Cel.Address
'MsgBox (Cel.Value)
' get next blank cell in row
Wk.Cells(Cel.Row, Wk.Columns.Count).End(xlUp).Offset(, 1).Value = Cel.Value
End If

Next

myData.Close True 'save & close

End Sub
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Sorry Everyone i am trying to close this Thread but cannot find a way to remove it. Please ignore
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,307
Members
452,633
Latest member
DougMo

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