|
-
Aug 25th, 2006, 12:26 AM
#1
Thread Starter
Addicted Member
using a macro
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 .
-
Aug 25th, 2006, 12:38 AM
#2
Fanatic Member
Re: using a macro
FIRST ADD A REFERENCE TO YOUR PROJECT as excel.
creaTE AN OBJECT OF TYPE eXCEL.aPPLICATION.
-
Aug 25th, 2006, 12:43 AM
#3
Thread Starter
Addicted Member
Re: using a macro
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 .
-
Aug 25th, 2006, 12:47 AM
#4
Fanatic Member
Re: using a macro
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..
-
Aug 25th, 2006, 01:11 AM
#5
Thread Starter
Addicted Member
Re: using a macro
can u just give me an example code for that plzzz
-
Aug 25th, 2006, 01:15 AM
#6
Fanatic Member
Re: using a macro
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|