Hello,
I was wondering if it is possible to detect a merged cell or range on one sheet(Sheet1) and merge the same cells in another sheet(Sheet2)?
The columns being copied over go from B to H in a loop
I am copying them row by row until LastRow.
Not every cell in each B H range is going to be merged. Each row is going to be different.
Example B to C could be merged in 1 row
or B to E merged
or C to D merged or any combination.
Merging is the only formatting I want. I don't want interior colors and borders.
Is there a way to copy over the row in the loop
find which cells are merged Sheet1 and copy them over to the other sheet Sheet2? and retain values in whatever cells there are?
here is my code for copying
I was wondering if it is possible to detect a merged cell or range on one sheet(Sheet1) and merge the same cells in another sheet(Sheet2)?
The columns being copied over go from B to H in a loop
I am copying them row by row until LastRow.
Not every cell in each B H range is going to be merged. Each row is going to be different.
Example B to C could be merged in 1 row
or B to E merged
or C to D merged or any combination.
Merging is the only formatting I want. I don't want interior colors and borders.
Is there a way to copy over the row in the loop
find which cells are merged Sheet1 and copy them over to the other sheet Sheet2? and retain values in whatever cells there are?
here is my code for copying
Code:
Dim lRowAdd As Long
lRow = Sheets("Datasheet-C").Cells(Rows.Count, "AAA").End(xlUp).Row
lRowAdd = lRow
Dim i As Integer
For i = 1 To lRowAdd
Sheets("Datasheet-C").Range("AAA" & i).Value = 1
Sheets("Accredited").Range("B" & i).HorizontalAlignment = xlCenter
Sheets("Accredited").Range("B" & i).Value = Sheets("Datasheet-C").Range("B" & i).Text
Sheets("Accredited").Range("C" & i).HorizontalAlignment = xlCenter
Sheets("Accredited").Range("C" & i).Value = Sheets("Datasheet-C").Range("C" & i).Text
Sheets("Accredited").Range("D" & i).HorizontalAlignment = xlCenter
Sheets("Accredited").Range("D" & i).Value = Sheets("Datasheet-C").Range("D" & i).Text
Sheets("Accredited").Range("E" & i).HorizontalAlignment = xlCenter
Sheets("Accredited").Range("E" & i).Value = Sheets("Datasheet-C").Range("E" & i).Text
Sheets("Accredited").Range("F" & i).HorizontalAlignment = xlCenter
Sheets("Accredited").Range("F" & i).Value = Sheets("Datasheet-C").Range("F" & i).Text
Sheets("Accredited").Range("G" & i).HorizontalAlignment = xlCenter
Sheets("Accredited").Range("G" & i).Value = Sheets("Datasheet-C").Range("G" & i).Text
Sheets("Accredited").Range("H" & i).HorizontalAlignment = xlCenter
Sheets("Accredited").Range("H" & i).Value = Sheets("Datasheet-C").Range("H" & i).Text
Next