Hallo All! I am very new to VBA Excel and i have a question. I have a sub routine which outputs some information in a cell that is separated by space. Something like that: "asda asda efrrwe werw 234 sfds". I just just to place each one of them in different cells! Could you help me out?! (i am not so into programming..)
Thanks!
Can you show your existing code, remember to use Code Tags
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
Check out the free Excel Toolbar
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Code Tags: Make your code easier for us to read
This is basically an example code that i use together with imacro program. It reads a list of company names (companyname) and for every one of the list outputs a stock value.If you chose to output more than one value for every company name you get all infos in the same cell separated by space.
Could you help me out output those values, one in each cell?
Thanks Again for your quick reply!
pomolo
Code:Option Explicit Private Sub CommandButton1_Click() MsgBox "This script demonstrates how to read data from an Excel sheet and using this, capture information from a website." Dim iim1, iret, row, totalrows Set iim1 = CreateObject("imacros") iret = iim1.iimInit iret = iim1.iimDisplay("Submitting Data from Excel") 'Insert todays date Cells(1, 2).Value = Date 'Navigate to the site and extract the first price row = 2 'Set the variable iret = iim1.iimSet("-var_companyname", Cells(row, 1).Value) 'Set the display iret = iim1.iimDisplay("Row# " + CStr(row)) 'Run the macro iret = iim1.iimPlay("VBA-StockSearch1") If iret < 0 Then MsgBox iim1.iimGetLastError() End If Cells(row, 2).Value = Replace(iim1.iimGetLastExtract(), "[EXTRACT]", " ")
I can't test the code, it's not working on my computer. You should not really give a variable a name like Row, it may cause problems
Try this untested but it might work. 10 is only a guess for the rows
Code:Private Sub CommandButton1_Click() MsgBox "This script demonstrates how to read data from an Excel sheet and using this, capture information from a website." Dim iim1, iret Dim totalrows As Long Dim rw As Long Set iim1 = CreateObject("imacros") iret = iim1.iimInit iret = iim1.iimDisplay("Submitting Data from Excel") 'Insert todays date Cells(1, 2).Value = Date 'Navigate to the site and extract the first price For rw = 2 To 10 'Set the variable iret = iim1.iimSet("-var_companyname", Cells(rw, 1).Value) 'Set the display iret = iim1.iimDisplay("rw# " + CStr(rw)) 'Run the macro iret = iim1.iimPlay("VBA-StockSearch1") If iret < 0 Then MsgBox iim1.iimGetLastError() End If Cells(rw, 2).Value = Replace(iim1.iimGetLastExtract(), "[EXTRACT]", " ") Next rw
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
Check out the free Excel Toolbar
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Code Tags: Make your code easier for us to read
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks