Select a single line even if there are merged cells with VBA

Closed
Jerry - Aug 17, 2016 at 03:39 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Aug 25, 2016 at 11:39 AM
Hello,

I'm creating a worksheets that needs to be protected at all time. However, users may need to duplicate a line sometimes. What I want to do here is to make them choose a location where to insert a new line - by selecting this line, the code copies the line above (containing formulas) and insets it below the selected line.

I'm able to unprotect the sheet and make appear the input.box and etc, however, most of the cells in row B are merged with other cells above or below in that same row. So far, application.inputbox allows me to select a line, but if that line has some merged cells with others lines, the application selects all the lines connected by this cell containing merged cells in row B and therefore I've selected many lines.

Do you know how to select a single line regardless if it has merged cells or not in row B and then copy it with VBA ? Is application.inputbox the right way to do it?

Greatly appreciated!

Jerry

1 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Aug 25, 2016 at 11:39 AM
Hi Jerry,

Merged cells don't work well with VBA. You will have to start your code by unmerging first then finish the code by merging the cells again.

Best regards,
Trowa
0