PDA

View Full Version : Sleeper: Worksheet accessing



Zod
08-11-2005, 08:21 AM
Hi everyone! 1st Post!!

Alrighty then, I'm currently attempting to read some data from a closed workbook in a different directory. I'll explain further...

I have a text box for users to enter a name into, this is held on the Master workbook - Names are held along with other data on a row in a separate workbook - And this is the data I need to search on - If the textbox data is found then I need to return the row to the master workbook - Does this make sense???

Techy bit..

Workbook 2 is read only.
The Workbook 2 sheet name will change every month to the months name e.g. July, August etc.
Workbook 2 contains data from columns A through to M
Names are held on Column D starting from D4 and going down to around D4000
There will be more than one instance of the name and I'd like to be able to return all instances into the Master workbook

In the Master Workbook, my textbox is called txtName and it has a command button called cmdSearch - I would like to return the data to Sheet2 in the Master Workbook

I hope this covers all areas and someone can offer some aid! : pray2:

Many thanks!

Zod.

mdmackillop
08-11-2005, 09:40 AM
Hi Zod,
Welcome to VBAX.
If you can zip and post a sample of your workbook(s) (suitably sanitised to remove confidential stuff) this is of great help. To attach the zip file, click on Go Advanced below the message box and then the Manage Attachments button.
Regards
MD

Zod
08-12-2005, 02:24 AM
Hi! I seem to be having major difficulties attaching a workbook! I click on upload and it asks me to log in - I log in and it asks me which file to upload - I select my ZIP file and click upload, it then asks me to log in again which I do and it tells me I have "Invalid Post specified. If you followed a valid link, please notify the webmaster"

Is it something I'm doing?

Cheers,

Zod

Zod
08-12-2005, 07:06 AM
Has this worked?

mdmackillop
08-12-2005, 11:57 AM
I've added in code to get data from the closed workbook. For testing, save both files into C:\AAA\.
I've added a routine to list the names on sheet 1, and use this as a source list for a combobox, rather than the textbox entry. This does slow down the initial opening, but should prevent data errors. It is easily removed if not required. The code could do with some tidying, but it works with the limited names supplied. Let me know how you get on with 4000.
Regards
MD

Zod
08-17-2005, 02:22 AM
Works great - But I get a problem with blank lines - On the Log1.xls sheet there seems to be some 'separators' for weekly data - This is causing a runtime error 13 'Type-Mismatch' error to occur on the


Private Sub cmdSearch_click()
Dim....
Dim....
Applic...
For r = .....
c= 3
a = Cells.....
LOG1NAME = GETVALUE(p, f, s, a) <--------Possibly because the data it's attempting to receive is from a blank line?

On the
'Execute an XLM Macro
GetValue = ExecuteExcel4Macro(arg) line when I highlight GetValue it shows as "GetValue = Error 2042"

Thanks for your support on this! And Great Job on the coding side!!!!!

Many, MANY thanks!

Zod.
- Also I am wondering whether it is possible for the program to determine the length of data as the data for August is not 4000 rows but currently 800 and the program loops through 4000 rows -