M
Myles
Okay so using some code i have tried and tried to get this to work in
different ways but cant figure out why it's not working
For easy sakes we will say that
intRowNum = 2
strDescription = "Comment goes here"
' This should basically have theCell return as like "D2" or whichever letter
it is
theCell = ColumnLetter(LastColumn(intRowNum)) & intRowNum
Range(theCell).AddComment (strDescription)
Function LastColumn(Row As String) As String
' This gets the last column in a row when the row is specified
LastColumn = ActiveSheet.Cells(intRowNum,
Columns.Count).End(xlToLeft).Column + 1
End Function
Function ColumnLetter(ColumnNumber As Integer) As String
' This converts the column back to the appropriate letter
If ColumnNumber > 26 Then
ColumnLetter = Chr(Int((ColumnNumber - 1) / 26) + 64) & _
Chr(((ColumnNumber - 1) Mod 26) + 65)
Else
ColumnLetter = Chr(ColumnNumber + 64)
End If
End Function
Basically i already know what the row is, i just need to find the last
column of that row that has no text in it, and then add my own comment to it.
Thanks for the help guys!
different ways but cant figure out why it's not working
For easy sakes we will say that
intRowNum = 2
strDescription = "Comment goes here"
' This should basically have theCell return as like "D2" or whichever letter
it is
theCell = ColumnLetter(LastColumn(intRowNum)) & intRowNum
Range(theCell).AddComment (strDescription)
Function LastColumn(Row As String) As String
' This gets the last column in a row when the row is specified
LastColumn = ActiveSheet.Cells(intRowNum,
Columns.Count).End(xlToLeft).Column + 1
End Function
Function ColumnLetter(ColumnNumber As Integer) As String
' This converts the column back to the appropriate letter
If ColumnNumber > 26 Then
ColumnLetter = Chr(Int((ColumnNumber - 1) / 26) + 64) & _
Chr(((ColumnNumber - 1) Mod 26) + 65)
Else
ColumnLetter = Chr(ColumnNumber + 64)
End If
End Function
Basically i already know what the row is, i just need to find the last
column of that row that has no text in it, and then add my own comment to it.
Thanks for the help guys!