PC Review


Reply
Thread Tools Rate Thread

Database macro

 
 
Rachel
Guest
Posts: n/a
 
      28th Jun 2009

Help! I need a macro code in such a way that when you type a word in a
USERFORM it reflects the word typed on that form in 2 seperate worksheets
(database) wherein it is linked to the same details.

To elaborate, I have 3 worksheets. Worksheet 1 contains LOOKUP function
wherein you search for a particular reference code then it appears. You then
click on that reference code and a userform pops out with a box for REMARKS.
Is there a code which I can use so that the remark entered into this box is
reflected in worksheet 2 and 3 which is a database that contains a list of
different reference codes but the remarks will have to be placed on the
particular reference code that was looked up in worksheet 1. THANKS!
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      28th Jun 2009
Rachel,

Try something like..Adjust to suit your requirement/

Dim ws1 As Worksheet, ws2 As Worksheet
Set ws1 = ActiveWorkbook.Sheets("Sheet1")
Set ws2 = ActiveWorkbook.Sheets("Sheet2")

'Sheet1. Assuming remarks is to be in Col A
ws1.Range("B" & ActiveCell.Row) = "Remarks"

'Sheet2.Check for the code in ColA and if exists get the row number
If WorksheetFunction.CountIf(ws2.Range("A:A"), "code") > 0 Then
lngRow = WorksheetFunction.Match("code", ws2.Range("A:A"), 0)
'Write remarks in ColB
Range("B" & lngRow) = "Remarks"
End If

If this post helps click Yes
---------------
Jacob Skaria


"Rachel" wrote:

> Help! I need a macro code in such a way that when you type a word in a
> USERFORM it reflects the word typed on that form in 2 seperate worksheets
> (database) wherein it is linked to the same details.
>
> To elaborate, I have 3 worksheets. Worksheet 1 contains LOOKUP function
> wherein you search for a particular reference code then it appears. You then
> click on that reference code and a userform pops out with a box for REMARKS.
> Is there a code which I can use so that the remark entered into this box is
> reflected in worksheet 2 and 3 which is a database that contains a list of
> different reference codes but the remarks will have to be placed on the
> particular reference code that was looked up in worksheet 1. THANKS!

 
Reply With Quote
 
Rachel
Guest
Posts: n/a
 
      28th Jun 2009

Hi Jacob,

Thank you for this, but how can I modify the code in such a way that REMARKS
is reflected on two worksheets? THANKS! Sorry newbie on macro

Rachel

"Jacob Skaria" wrote:

> Rachel,
>
> Try something like..Adjust to suit your requirement/
>
> Dim ws1 As Worksheet, ws2 As Worksheet
> Set ws1 = ActiveWorkbook.Sheets("Sheet1")
> Set ws2 = ActiveWorkbook.Sheets("Sheet2")
>
> 'Sheet1. Assuming remarks is to be in Col A
> ws1.Range("B" & ActiveCell.Row) = "Remarks"
>
> 'Sheet2.Check for the code in ColA and if exists get the row number
> If WorksheetFunction.CountIf(ws2.Range("A:A"), "code") > 0 Then
> lngRow = WorksheetFunction.Match("code", ws2.Range("A:A"), 0)
> 'Write remarks in ColB
> Range("B" & lngRow) = "Remarks"
> End If
>
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "Rachel" wrote:
>
> > Help! I need a macro code in such a way that when you type a word in a
> > USERFORM it reflects the word typed on that form in 2 seperate worksheets
> > (database) wherein it is linked to the same details.
> >
> > To elaborate, I have 3 worksheets. Worksheet 1 contains LOOKUP function
> > wherein you search for a particular reference code then it appears. You then
> > click on that reference code and a userform pops out with a box for REMARKS.
> > Is there a code which I can use so that the remark entered into this box is
> > reflected in worksheet 2 and 3 which is a database that contains a list of
> > different reference codes but the remarks will have to be placed on the
> > particular reference code that was looked up in worksheet 1. THANKS!

 
Reply With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      28th Jun 2009

Rachel, in the below code "remarks" is being written to both sheet1 and sheet2.

If this post helps click Yes
---------------
Jacob Skaria


"Rachel" wrote:

> Hi Jacob,
>
> Thank you for this, but how can I modify the code in such a way that REMARKS
> is reflected on two worksheets? THANKS! Sorry newbie on macro
>
> Rachel
>
> "Jacob Skaria" wrote:
>
> > Rachel,
> >
> > Try something like..Adjust to suit your requirement/
> >
> > Dim ws1 As Worksheet, ws2 As Worksheet
> > Set ws1 = ActiveWorkbook.Sheets("Sheet1")
> > Set ws2 = ActiveWorkbook.Sheets("Sheet2")
> >
> > 'Sheet1. Assuming remarks is to be in Col A
> > ws1.Range("B" & ActiveCell.Row) = "Remarks"
> >
> > 'Sheet2.Check for the code in ColA and if exists get the row number
> > If WorksheetFunction.CountIf(ws2.Range("A:A"), "code") > 0 Then
> > lngRow = WorksheetFunction.Match("code", ws2.Range("A:A"), 0)
> > 'Write remarks in ColB
> > Range("B" & lngRow) = "Remarks"
> > End If
> >
> > If this post helps click Yes
> > ---------------
> > Jacob Skaria
> >
> >
> > "Rachel" wrote:
> >
> > > Help! I need a macro code in such a way that when you type a word in a
> > > USERFORM it reflects the word typed on that form in 2 seperate worksheets
> > > (database) wherein it is linked to the same details.
> > >
> > > To elaborate, I have 3 worksheets. Worksheet 1 contains LOOKUP function
> > > wherein you search for a particular reference code then it appears. You then
> > > click on that reference code and a userform pops out with a box for REMARKS.
> > > Is there a code which I can use so that the remark entered into this box is
> > > reflected in worksheet 2 and 3 which is a database that contains a list of
> > > different reference codes but the remarks will have to be placed on the
> > > particular reference code that was looked up in worksheet 1. THANKS!

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compact and Repair a database from a macro in a different database DDogCap Microsoft Access 3 3rd Aug 2008 04:41 AM
Can I run a macro in a stored database from an open database? Beverly76 Microsoft Access Macros 1 26th Jun 2008 09:08 PM
HELP: Need macro for excel to get data from server database and use results to populate an Access Database Clinton M James Microsoft Access 1 7th Oct 2007 04:32 PM
Using Excel as a database and need macro or vba to take data entered on one tab and update the database by adding to the next avail row rjr Microsoft Excel Programming 5 11th Jun 2006 09:43 PM
starting database macro from outside of the database Roy Hicks Microsoft Powerpoint 0 13th Jan 2004 08:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:41 AM.