on data add formula

J

Jumparound

Hi guys (and girls)
I got a simple question...

i got a table of data thats gatherd by a macro, now i want to add 1
more line to this table.
but im not sure how to do this...

The data im looking for is "Legbord" in collum A and it has a value in
collum C.
I want to add a new line after "Legbord" (which isnt the last entry in
my table) and multiply the value for "legbord" in collum C with 2. (in
collum C for the new line)

Does this make sense?
Could you please help me?

thanks!

Sjoerd
 
T

Tom Ogilvy

Dim res as Variant, rng as Range
res = Application.Match("Legbord",columns(1),0)
if not iserror(res) then
set rng = cells(res,1)
rng.offset(1,0).Entirerow.Insert
cells(res + 1,1) = rng.Value
cells(res + 1,3).Value = rng.offset(0,2)*2
End if
 
J

Jumparound

Dim res as Variant, rng as Range
res = Application.Match("Legbord",columns(1),0)
if not iserror(res) then
set rng = cells(res,1)
rng.offset(1,0).Entirerow.Insert
cells(res + 1,1) = rng.Value
cells(res + 1,3).Value = rng.offset(0,2)*2
End if

--
Regards,
Tom Ogilvy








- Tekst uit oorspronkelijk bericht weergeven -

Thanks Tom!

one quick question,

U use res = Application.Match("Legbord",columns(1),0)
What do i change when I want to insert the name "plankdrager" instead
in "legbord" in the newly created line?
 
J

Jumparound

Thanks Tom!

one quick question,

U use res = Application.Match("Legbord",columns(1),0)
What do i change when I want to insert the name "plankdrager" instead
in "legbord" in the newly created line?- Tekst uit oorspronkelijk bericht niet weergeven -

- Tekst uit oorspronkelijk bericht weergeven -

Oke, i treid some things...
this is what i got (it very ugly :( )

==========================
oRange.Offset(1, 0).EntireRow.Insert
Cells(res + 1, 1) = oRange.Value
Cells(res + 1, 3).Value = oRange.Offset(0, 2) * 2
Cells(res + 1, 1).Value = "Plankdrager"
==========================

i just copy "plankdrager" over the "legbord" cell...

Many thanks for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top