i have recorded a macro in excel now i want it to use in the vb . i hav copy it from VBA in the excel . now plz tellme how to use that code in vb .
Printable View
i have recorded a macro in excel now i want it to use in the vb . i hav copy it from VBA in the excel . now plz tellme how to use that code in vb .
FIRST ADD A REFERENCE TO YOUR PROJECT as excel.
creaTE AN OBJECT OF TYPE eXCEL.aPPLICATION.
thanx its done
tellme 1 more thing
in my excel i hav a field name article num. ,what i want is that a code that checks the first column(article num) of the sheet till the article num is same, as a different article num comes it inserts a new row and adds the data of the column amount and writes it inti that row .
you can save previous cell value in a temparory variable.
and for each record, check old value with current, if it is not same add a blank row then assign old value to current value.and so on..
can u just give me an example code for that plzzz
VB Code:
oldval=sheet1.cells(1,1)''''first val for i = 2 to allrecords if oldval <> sheet1.cells(i,1) then 'insert a blank row oldval=sheet1.cells(i,1) end if next