Value generated thru code can be compared and pasted? (1 Viewer)

Ashfaque

Student
Local time
Tomorrow, 00:09
Joined
Sep 6, 2004
Messages
894
Hi,

I have some code behind in micro that executes an excel sheet once you start opening the excel file. Basically it reads pc address in variable GetMacAddress and displays in a msg on the screen.

Basically this is to protect my excel sheet of being used by others without my approval. Even someone takes my excel sheet and run on his pc it will bring the
pc address and it should match with pc address that I wrote somewhere on sheet. If both are matching then, the sheets calculation will run smoothly.

Till executing and bringing the pc adress in GetMacAddress value in a msgbox is ok. It is displaying fine.

Now my question is how can I paste this GetMacAddress value at the desired cell in desired sheet thru code and further it should compare with each other to run the sheet otherwize, quit excel application.
 

Gasman

Enthusiastic Amateur
Local time
Today, 18:39
Joined
Sep 21, 2011
Messages
14,046
You can do all that, yet cannot set a cell value? :confused:

I use
Code:
Range("A1").Value = strVariable

HTH
 

Ashfaque

Student
Local time
Tomorrow, 00:09
Joined
Sep 6, 2004
Messages
894
Thanks Gasman,

And sorry for my late reply.

What could be the code to refresh if I click a button that pasted on sheet?

Thanks again.
 

Gasman

Enthusiastic Amateur
Local time
Today, 18:39
Joined
Sep 21, 2011
Messages
14,046
Thanks Gasman,

And sorry for my late reply.

What could be the code to refresh if I click a button that pasted on sheet?

Thanks again.

Literally what I posted, except strVariable would be GetMacAddress ?

Put the code in the Wookbook_Open event and no need for a button.?

HTH
 

Ashfaque

Student
Local time
Tomorrow, 00:09
Joined
Sep 6, 2004
Messages
894
Put the code in the Wookbook_Open event and no need for a button.?

When opens my sheet in other pc, it wont refresh thats why I thought we need to refresh the code under a button.

This button have other code lines also which are being executed smoothly.

thanks,
 

Gasman

Enthusiastic Amateur
Local time
Today, 18:39
Joined
Sep 21, 2011
Messages
14,046
Well put the code where you like, just assign the cell value to the result of the function as shown previously.
 

Users who are viewing this thread

Top Bottom