Database form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Newbie question:

I am looking for the best way to fill in a form (in sheet 1) after the
database has been done (in sheet 2). Don't want to use the Form feature of
Excel as I want to print and distribute the reports.

My question is how I can fill in the cell of the form that i want from the
database?

Form:

ID: 2

Status: Done
City: LA
Paid: NO


Database:

ID Status City Paid
1 Done Kansas Yes
2 Done LA No
3 Working on Denver Yes


Thanks for your help.

Paul
 
I'd suggest an approach like this:

Sub SetData()
Dim Idx As Integer
Dim DataRow As Range
Idx = Range("Idx").Value
Set DataRow = Range("Database").Rows(Idx)
Range("IDCell").Value = DataRow.Cells(1).Value
Range("CityCell").Value = DataRow.Cells(2).Value
Range("PaidCell").Value = DataRow.Cells(3).Value
End Sub

--
Jim
| Newbie question:
|
| I am looking for the best way to fill in a form (in sheet 1) after the
| database has been done (in sheet 2). Don't want to use the Form feature
of
| Excel as I want to print and distribute the reports.
|
| My question is how I can fill in the cell of the form that i want from the
| database?
|
| Form:
|
| ID: 2
|
| Status: Done
| City: LA
| Paid: NO
|
|
| Database:
|
| ID Status City Paid
| 1 Done Kansas Yes
| 2 Done LA No
| 3 Working on Denver Yes
|
|
| Thanks for your help.
|
| Paul
|
|
|
 

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

Back
Top