ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Write Data to Excel Database (https://www.excelbanter.com/excel-programming/320992-write-data-excel-database.html)

James W.[_2_]

Write Data to Excel Database
 
I have an input form that I am trying to update an excel database with. What
I need the macro to do is using the account number find the entry in the
database and write the value that are on the input form.

Would the find and offset be the best way to do this or is their another
alternative.

Tom Ogilvy

Write Data to Excel Database
 
I would say yes.

--
Regards,
Tom Ogilvy

"James W." wrote in message
...
I have an input form that I am trying to update an excel database with.

What
I need the macro to do is using the account number find the entry in the
database and write the value that are on the input form.

Would the find and offset be the best way to do this or is their another
alternative.




Charles Harmon

Write Data to Excel Database
 
Hi,

If you are using a userform then this may help.

Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
'' This assumns you have a userform1 with txtbox named txtaccount
With UserForm1
Cells.Find(What:=txtaccount, LookIn:=xlValues, LookAt:=xlPart).Activate
If Err = "91" Then
MsgBox "Could not find Account: " & .txtaccount
Exit Sub
End If
''' assumes account is in column "A" '''
Cells(ActiveCell, 2).Value = .txtmytxt1 ''' assumes value goes in column
2
''or Cells(ActiveCell, 1).Offset(,1).Value = .txtmytxt1''' assumes value
goes in column 2
Cells(ActiveCell, 3).Value = .txtmytxt2 ''' assumes value goes in column
3
Cells(ActiveCell, 4).Value = .txtmytxt3 ''' assumns value goes in column
4
Cells(ActiveCell, 5).Value = .txtmytxt4 ''' assumns value goes in column
5
End With

End Sub

"James W." wrote in message
...
I have an input form that I am trying to update an excel database with.
What
I need the macro to do is using the account number find the entry in the
database and write the value that are on the input form.

Would the find and offset be the best way to do this or is their another
alternative.





All times are GMT +1. The time now is 12:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com