No No, it was just that my "real" did disturb me "a bit", causing this last mistake.
But I think this threat should be closed now!
Printable View
No No, it was just that my "real" did disturb me "a bit", causing this last mistake.
But I think this threat should be closed now!
Opus..1 more pls.. I've used ur above codes to display another comments(on Vessel names) in the 2nd cell(prev u did was for the 1st cells).I did make changes to the codes. However, when I run into that procedure, my app gets "hang" I guess something is wrong wit the code when I changed it? I can't figure out. I'll send u the pivot table Im using now(it's the same as prev one).Hope u do have the Excel sheet.I've placed the code in a module(simply codes, this file dont run)Thanks to solve my bugs.Pls..
two mistakes in there:
Interested in a code that does all three at same time???VB Code:
Sub VesselComments1() Dim i As Integer Dim j As Integer Dim k As Integer Dim l As Integer Dim Name As String Dim Period As Integer Dim BlkName As String Dim MaxNumber As Integer Dim CommentText As String Dim Vessel_Number As Integer MaxNumber =[b] 300[/b] Sheets("mapview").Activate 'for Periods 0 to 8 For k = 0 To 8 'First block of alphanumerics (15 Values) For i = 1 To 15 For j = 3 To MaxNumber If Sheets("sparePivot").Cells(j, 1).Value = Sheets("mapview").Cells(1 + 2 * i, 12 * k + [b]2[/b]).Value Then 'Count the rows that are for the same "From_blk" Vessel_Number = 1 For l = j + 1 To j + 20 If Sheets("sparePivot").Cells(l, 1).Value = Sheets("sparePivot").Cells(j, 1).Value & " Total" Then Vessel_Number = l - j Next l CommentText = "" Sheets("mapview").Cells(2 + 2 * i, 12 * k + 2).ClearComments For l = 0 To Vessel_Number - 1 If Not Sheets("sparePivot").Cells(j + l, k + 3).Value = Empty Then CommentText = CommentText & Sheets("sparePivot").Cells(j + l, 2).Value & Chr(10) End If Next l If Not CommentText = "" Then Sheets("mapview").Cells(2 + 2 * i, 12 * k + 2).AddComment Sheets("mapview").Cells(2 + 2 * i, 12 * k + 2).Comment.Visible = False Sheets("mapview").Cells(2 + 2 * i, 12 * k + 2).Comment.Text Text:=CommentText End If End If Next j Next i 'Second block of alphanumerics (15 Values) For i = 1 To 15 For j = 3 To MaxNumber If Sheets("sparePivot").Cells(j, 1).Value = Sheets("mapview").Cells(1 + 2 * i, 12 * k + [b]6[/b]).Value Then 'Count the rows that are for the same "From_blk" Vessel_Number = 1 For l = j + 1 To j + 20 If Sheets("sparePivot").Cells(l, 1).Value = Sheets("sparePivot").Cells(j, 1).Value & " Total" Then Vessel_Number = l - j Next l CommentText = "" Sheets("mapview").Cells(2 + 2 * i, 12 * k + 6).ClearComments For l = 0 To Vessel_Number - 1 If Not Sheets("sparePivot").Cells(j + l, k + 3).Value = Empty Then CommentText = CommentText & Sheets("sparePivot").Cells(j + l, 2).Value & Chr(10) End If Next l If Not CommentText = "" Then Sheets("mapview").Cells(2 + 2 * i, 12 * k + 6).AddComment Sheets("mapview").Cells(2 + 2 * i, 12 * k + 6).Comment.Visible = False Sheets("mapview").Cells(2 + 2 * i, 12 * k + 6).Comment.Text Text:=CommentText End If End If Next j Next i 'Third block of alphanumerics (8 Values) For i = 1 To 8 For j = 3 To MaxNumber If Sheets("sparePivot").Cells(j, 1).Value = Sheets("mapview").Cells(1 + 2 * i, 12 * k + [b]10[/b]).Value Then 'Count the rows that are for the same "From_blk" Vessel_Number = 1 For l = j + 1 To j + 20 If Sheets("sparePivot").Cells(l, 1).Value = Sheets("sparePivot").Cells(j, 1).Value & " Total" Then Vessel_Number = l - j Next l CommentText = "" Sheets("mapview").Cells(2 + 2 * i, 12 * k + 10).ClearComments For l = 0 To Vessel_Number - 1 If Not Sheets("sparePivot").Cells(j + l, k + 3).Value = Empty Then CommentText = CommentText & Sheets("sparePivot").Cells(j + l, 2).Value & Chr(10) End If Next l If Not CommentText = "" Then Sheets("mapview").Cells(2 + 2 * i, 12 * k + 10).AddComment Sheets("mapview").Cells(2 + 2 * i, 12 * k + 10).Comment.Visible = False Sheets("mapview").Cells(2 + 2 * i, 12 * k + 10).Comment.Text Text:=CommentText End If End If Next j Next i Next k End Sub
ooooooohhh! why not, if u have the time to help me? U mean it will display all three fields at one go for the same blk against the periods? interesting... though all these works, actually im quite worried with my long chunky code(ugly) and wish to optimize them nicely.. Jus now ur solution hanged too..but dun worry.I've fixed that problem using Application.ScreenUpdating=False:D I think too tat tis thread is too long already.When u reply to me can u send me a private msg on wat ur thread title is about so tat i can get back to u if u have the solution or something else we can share..Thanks buddy:cool: