On Merging two cells (let's say B2 & C2) we get data in one cell (let's say B2).So, When I write a code for B2 target for Worksheet Selection event. It gives error Because it is taking target as Range B2:C2. What should I do?
On Merging two cells (let's say B2 & C2) we get data in one cell (let's say B2).So, When I write a code for B2 target for Worksheet Selection event. It gives error Because it is taking target as Range B2:C2. What should I do?
Instead of Target Use Target.Cells(1) which will target the first cell of target cell![]()
If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
Mark your thread as Solved
If the suggestion helps you, then Click *below to Add Reputation
Hi, tanvi_kalra,
a very good example why to avoid MergedCells, isn´t it?
Ciao,
Holger
Use Code-Tags for showing your code: [code] Your Code here [/code]
Please mark your question Solved if there has been offered a solution that works fine for you
Thanks
It works by using
Target.Cells(1).Address instead of Target.Address
If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
Instead of merging cells, it would be better if you formatted B2:C2 and just used
Format Cells\Alignment\Horizontal: center across selection
Then you wouldn't have the issues with merged cells.
Surround your VBA code with CODE tags e.g.;
[CODE]your VBA code here[/CODE]
The # button in the forum editor will apply CODE tags around your selected text.
Hi Sixthsense
Already marked it as solved and added reputation too..
Thanks Again![]()
Already tried that also. But i need to capture the cell value for the code . So , Cell value can be captured from one cell at a time.Re: Target Address after merging cells
Instead of merging cells, it would be better if you formatted B2:C2 and just used
Format Cells\Alignment\Horizontal: center across selection
Then you wouldn't have the issues with merged cells.
Surround your VBA code with code tags e.g.;
The pound # icon in the forum editor will apply the code tags around the selected text.![]()
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks