Hi all,
I have a cell which is merged with another cell , say B6 and C6
now is there a way to lock these cells..?
And if i want to retrieve the value entered in that merged cell then is there a way to do that using vba.?
Hi all,
I have a cell which is merged with another cell , say B6 and C6
now is there a way to lock these cells..?
And if i want to retrieve the value entered in that merged cell then is there a way to do that using vba.?
Regards
If I look its because i'm
Try playing around with this:
[vba]
Sub Lock_Merged_Copy_Merged()
Range("B6:C6").Locked = True
Range("B6:C6").Copy
Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub
[/vba]remember that "Locked" cells are not locked unless the woorksheet is protected!
Regards,
Simon
Please read this before cross posting!
In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
If I have seen further it is by standing on the shoulders of giants.
Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)
I would avoid merged cells. Try formatting for "center across selection instead. I have had so much trouble with files with merged cells that I almost refuse to work on one.
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
Thanks Simon
Is there a way to directly copy the value inside a variable or do i need to pick that value from cell A1.?
Regards
If I look its because i'm
Just set the cell value to the variable, the first cell of the merged cells.
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Exactly as Bob explained, i only pasted the value to A1 so you could see the code in action showing you that neither the source cell nor the destination cell were selected (you don't have to select an object in order to work with it), you can paste to whichever cell you like!
Regards,
Simon
Please read this before cross posting!
In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
If I have seen further it is by standing on the shoulders of giants.
Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)
Thanks a lot guys
Regards
If I look its because i'm