Hi,
First of all, I know that merged cells are really frowned upon. However, this is one of those cases that cannot be solved with a pivot table (at least, I don't think it can). Here is what I need:
I am a teacher that uses an excel sheet that my school system gave me. It uses merged cells. I am trying to enhance the sheet so that it saves my colleagues and me time. Basically, I am making a sheet that will automatically create letters home to parents after each test. I've created drop-down menus at the top to change the data dynamically.
I need to dynamically reference merged cells from another sheet. This wouldn't be a problem, but it is referencing many sheets, and each sheet has a different merge situation. The good news is, it is limited to one row.
The code that I have isn't nearly where it should be. I ran into a wall when I tried to use a variable inside the merge command. I am very new to this type of stuff; thank you for your patience!
Here is the code I have so far:
Option Explicit
Public Sub MergeRow()
Dim c As Range
[a1:ac1].UnMerge '<-Unmerge the cells from the old data.
'This will need to go somewhere else, before the new data is referenced.
Application.DisplayAlerts = False 'Prevent merge warning from popping up
For Each c In Range("A1:B1")
If c.Offset(0, 1).Value = "" Then
'[c:c.Offset(0, 1)].Merge <-not sure what the syntax would be here, but this aint it!
End If
Next c
End Sub
I've attached my excel worksheet. My code so far is located in the sheet entitled "Sheet 1."
Once this problem is fixed, there are a few other issues that I know I will run into--if I cannot fix them, should I post them in this thread, or should I create new threads? I'm guessing the latter, but please let me know which is more acceptable. Thank you so much in advance for your time!
Bookmarks