Excel button copy a value

July 14, 2009 at 01:48:35
Specs: win xp 5.1.2600, 3mhz/2 gig
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.

See More: Excel button copy a value

Report •

July 14, 2009 at 06:50:55
Any reason you can't simply use =B6 in B10?

Report •

July 14, 2009 at 06:58:29
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.

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

Report •

July 14, 2009 at 07:17:20
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

Report •

Related Solutions

July 14, 2009 at 08:28:48
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")

Report •

July 14, 2009 at 08:34:56
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.

Report •

Ask Question