Computing.Net > Forums > Office Software > Excel button copy a value

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Excel button copy a value

Reply to Message Icon

Name: lee123abc
Date: July 14, 2009 at 01:48:35 Pacific
OS: win xp 5.1.2600
CPU/Ram: 3mhz/2 gig
Product: Dell / PRECISION
Subcategory: Microsoft Office
Comment:

Hi all. I need code for a button in Excel 2003.
When I click the button I need it to copy the value in cell B6 to B10.
Thank you.



Sponsored Link
Ads by Google

Response Number 1
Name: DerbyDad03
Date: July 14, 2009 at 06:50:55 Pacific
Reply:

Any reason you can't simply use =B6 in B10?


0

Response Number 2
Name: lee123abc
Date: July 14, 2009 at 06:58:29 Pacific
Reply:

Well because half the time I will have to use a different variable. -Thanks though DerbyDad03!

I understand this is going to be quite tricky, but if anyone has some code, I would really appreciate it. Oh, I forgot to mention, the spreadsheet will be locked, and all I will be able to access will be cell B10, a couple other cells and the button.

Cheers
(I meant I will only be able to edit cell b10 and a button, because the spreadsheet is locked!)


0

Response Number 3
Name: lee123abc
Date: July 14, 2009 at 07:17:20 Pacific
Reply:

Please excuse me, but I do try to get the answer myself.
This looks like what I want, but is obviously wrong. I dont understand why though... I have never done this before.

Private Sub CommandButton1_Click()
Worksheets("Sheet1").Cell("a2").Value = Worksheets("Sheet1").Cell("a1")
End Sub


0

Response Number 4
Name: DerbyDad03
Date: July 14, 2009 at 08:28:48 Pacific
Reply:

re: the spreadsheet is locked!

Spreadsheets aren't locked. Spreadsheets are protected.

Cells are locked (by default) but the locking doesn't matter unless the sheet is protected.

If you are able to edit B10 in a protected sheet, then B10 must be unlocked.

You said that the code you posted is obviously wrong.

Try this...

Worksheets("Sheet1").Range("B10").Value = Worksheets("Sheet1").Range("B6")


0

Response Number 5
Name: lee123abc
Date: July 14, 2009 at 08:34:56 Pacific
Reply:

That works a treat!
You are right about the 'lock' and protected'! I suppose it must be difficult dealing with newbies!

Yes, cell B10 is unlocked. Which means I can manually type in a value, and now if I need to I can click the button to copy the value across from B6.

Cheers for that mate. Have a good one.


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

Outlook Buiness 2003 Simple VBA formula



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: Excel button copy a value

Excel Formula Copying www.computing.net/answers/office/excel-formula-copying/8925.html

Macro within Excel fixed to a specific sheet www.computing.net/answers/office/macro-within-excel-fixed-to-a-specific-sheet/9751.html

excel macro reads wrong value www.computing.net/answers/office/excel-macro-reads-wrong-value/2476.html