Excel Data Base Link
Tom,
This still only works in cell A1. How can I change it to be Relative to the
location of my courser?
Thank you,
"Tom Ogilvy" wrote:
Sub Button1_Click()
Dim rng As Range, rng1 As Range
Set rng = Workbooks("Data").Worksheets("Data").Range("A1:A20 00")
If Range("A1").Value = "" Then Exit Sub
Set rng1 = rng.Find(Range("A1"))
If rng1 Is Nothing Then
MsgBox "Not Found"
Exit Sub
End If
'now copy the data
rng1.Resize(1, 5).Copy Destination:=Cells(ActiveCell.Row,1)
rng1.Offset(0, 6).Copy Destination:=Cells(ActiveCell.Row,7)
End Sub
--
Regards,
Tom Ogilvy
"Trying Hard" wrote in message
...
Tom,
I appreciate you guidance. How can I get the Copy Destination:= to be
where
my courser resides? (in column A of course).
Because of your help this is what I ended up with:
Sub Button1_Click()
Dim rng As Range, rng1 As Range
Set rng = Workbooks("Data").Worksheets("Data").Range("A1:A20 00")
If Range("A1").Value = "" Then Exit Sub
Set rng1 = rng.Find(Range("A1"))
If rng1 Is Nothing Then
MsgBox "Not Found"
Exit Sub
End If
'no copy the data
rng1.Resize(1, 5).Copy Destination:=Range("A1")
rng1.Offset(0, 6).Copy Destination:=Range("G1")
End Sub
Thank you,
"Tom Ogilvy" wrote:
Assume Item No is in cell A1 of the calculator sheet which is the active
sheet. The database workbook is named "Data.xls" on a sheet named Data
with
Item numbers listed in columns A
Sub Button_click()
Dim rng as Range, rng1 as Range
set rng =Workbooks("Data").Worksheets("Data").Range("A1:A2 000")
if Range("A1").Value = "" then exit sub
set rng1 = rng.find(Range("A1")
if rng1 is nothing then
msgbox "Not Found"
exit sub
End if
' no copy the data
rng1.Resize(1,4).Copy Destination:=Range("A9")
rng1.offset(10,0).Resize(1,2).Copy Destination:=Range("J9")
' and so forth
End Sub
--
Regards,
Tom Ogilvy
"Trying Hard" wrote in message
...
I have a workbook with numbered data base items that I use along with
other
workbooks, which are calculators for this data base information. I
currently
go to the data base copy the whole row of information then go to the
calculator workbook and paste this information. This is tedious and
has
the
potential for errors because in my calculator workbook I have
protected
some
functions in certain cells staggered across the destination row, so I
would
like to create a macro that will respect the protected cells and
enable to
data base information to transfer with the entry of the Item number
only.
How can I enter, or paste, the item number that will automatically
enter
the
remaining item numbers information from a different workbook (data
base)?
--
Thank you,
Trying Hard
|