View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bart op de grote markt Bart op de grote markt is offline
external usenet poster
 
Posts: 5
Default Merging cells changes values, bug?

Hello,

I have a very strange problem in excel vba. I'm making some kind of
printable cards. Several cards can be displayed on the sheet (report
result) and they contain information which comes from a row on another
sheet (Backlog list). When the code is like below, everything wents
ok. Except that I want merged cells for C8:C9 and C12:C13 in the
first card and the corresponding ranges in the next cards. I want to
do that with the code that is in comment below. But when I do that,
all the merged cells of all cards get the same value of the merged
cells of the first card, while all I'm doing is changing a
property.... Maybe it is becoz the lay-out was copied from the first
card for every other card, I don't know, and that there then exists
some internal link? Anyway, the correct values are displayed when the
cells are not merged. This seems like a bug? Anyone knows if there
is a solution?

Kind regards,

Bart

Do While InStr(1, options_string, ",") < 0
Rows("1:15").Copy
Rows("1:15").Offset(15 * counter, 0).Select
ActiveSheet.Paste
'Range("B8:B9").Offset(15 * counter, 1).MergeCells = True
'Range("B8:B9").Offset(15 * counter, 1).WrapText = True
'Range("B12:B13").Offset(15 * counter, 1).MergeCells = True
'Range("B12:B13").Offset(15 * counter, 1).WrapText = True
current_row = left(options_string, InStr(1, options_string, ",") -
1)
options_string = right(options_string, Len(options_string) -
InStr(1, options_string, ","))
With Worksheets("Report Result")

.Range("C3").Offset(15 * counter, 0).Value = "Backlog Item " &
Worksheets("Backlog List").Range("B" & current_row).Value
.Range("C5").Offset(15 * counter, 0).Value =
Worksheets("Backlog List").Range("D" & current_row).Value
.Range("C8").Offset(15 * counter, 0).Value =
Worksheets("Backlog List").Range("H" & current_row).Value

.Range("C12").Offset(15 * counter, 0).Value =
Worksheets("Backlog List").Range("G" & current_row).Value

.Range("E5").Offset(15 * counter, 0).Value =
Worksheets("Backlog List").Range("E" & current_row).Value
.Range("E8").Offset(15 * counter, 0).Value =
Worksheets("Backlog List").Range("F" & current_row).Value


End With
counter = counter + 1
Loop