Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Getting Data from a worksheet to a form - and back again

Hello,

I am new to VBA (Excel 2007), and am struggling with the syntax to get data
from a form into a worksheet.

The scenario:
1. The 'Contacts' worksheet contains customer contacts - name, address,
phone, etc. The user scrolls around, looking for someone to call. When they
find one,
2. Run a macro that calls a module to pull the current row's data into a
form. This is working.
3. Add contact info (e.g. who you talked to, date/time, notes) to the form;
then
4. Click the 'AddContact' command button on the form, which will
5. Add a new row to the 'Contacts' worksheet, with the data collected on
the form.

Steps 1-3 are working. Step 2 has code like this:

Selection.Font.Bold = True

' Get the data from the spreadsheet to the form
ContactForm.Company = Cells(ActiveCell.Row, 2)
ContactForm.Contact = Cells(ActiveCell.Row, 4)
ContactForm.Address = Cells(ActiveCell.Row, 5)
...
ContactForm.AttemptName = Cells(ActiveCell.Row, 4)
ContactForm.AttemptDate = Date
ContactForm.AttemptTime = Time
ContactForm.AttemptPhone = Cells(ActiveCell.Row, 11)

ContactForm.Show

I am struggling with the syntax to pull the data from the form into the
spreadsheet (via the on_click event in the command button).

Where can I go to find syntax examples?

Thanks in advance,

--Dan
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Write data back from a form to sheet Steen Excel Discussion (Misc queries) 9 October 22nd 08 01:22 PM
Data back to Form??? Chris Watson[_3_] Excel Programming 0 March 12th 06 01:51 PM
Passing data back from a form Chris A[_3_] Excel Programming 0 November 27th 03 11:53 PM
Passing data back from a form Taras Excel Programming 0 November 24th 03 04:33 PM
Passing data back from a form Tom Ogilvy Excel Programming 0 November 24th 03 04:27 PM


All times are GMT +1. The time now is 02:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"