Copying values between sheets

B

bbuzz

I have an excel file with several sheets. I want to copy values on
sheet 1 using a macro command because I have several values to copy
each day. One value of interest is located on sheet 1 at range b11.

On sheet 2 I have 2 columns, one column called -ind1- returns a '1'
when todays date is entered. The other column called -TSCRAL- is where
I want the value from Sheet 1 pasted (at the intersect of the returned
value 1 of 'ind1' column depending on the date)
 
T

Tom Ogilvy

Dim rng as Range, rng1 as range
Dim res as Variant
Dim rng2 as Range
with worksheets("Sheet2")
set rng = .rows(1).Find("-ind1-")
set rng1 = .rows(1).Find("-TSCRAL-")
if not rng is nothing and not rng1 is nothing then
res = Application.Match(1,rng.EntireColumn,0)
if not iserror(res) then
set rng2 = rng1(res)
else
msgbox "Today's date not entered"
exit sub
end if
else
msgbox "column not found"
exit sub
end if
End With
worksheets("Sheet1").copy Destination:=rng2
 
B

bbuzz

'
Dim isect As Range
Dim res As Range
Sheets("Ajust. Rapport Jour").Select
Range("B11").Select
Selection.Copy
Sheets("Base de Données").Select
res = Application.Match(1, Range("IND1"), 0)
Set isect = Application.Intersect(Range("res"), Range("TSCRAL"))
isect.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False 'Removes the marquee.
End Sub



Tried a mixture from a few forums to come up with this, but still no
luck.
 
B

bbuzz

'
Dim isect As Range
Dim res As Range
Sheets("Ajust. Rapport Jour").Select
Range("B11").Select
Selection.Copy
Sheets("Base de Données").Select
res = Application.Match(1, Range("IND1"), 0)
Set isect = Application.Intersect(Range("res"), Range("TSCRAL"))
isect.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False 'Removes the marquee.
End Sub



Tried a mixture from a few forums to come up with this, but still n
luck
 

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