![]() |
Return Address of Blank Cells in MsgBox
Hello -
I have cells T10:T25. I need to return the address in a MsgBox if the cell is empty; e.g., say T11 and T15 are empty, in the messagebox it would refer specifically to T11 and T15. Any suggestions are greatly appreciated! -- Sandy |
Return Address of Blank Cells in MsgBox
Maybe:
Dim msg As String msg = "Blank cells found:" & Chr(10) On Error Resume Next msg = msg & Range("T11:T25").SpecialCells(xlCellTypeBlanks).Ad dress On Error GoTo 0 MsgBox msg Hope this helps Rowan "Sandy" wrote: Hello - I have cells T10:T25. I need to return the address in a MsgBox if the cell is empty; e.g., say T11 and T15 are empty, in the messagebox it would refer specifically to T11 and T15. Any suggestions are greatly appreciated! -- Sandy |
Return Address of Blank Cells in MsgBox
One way:
Option Explicit Sub testme() Dim myStr As String Dim myRng As Range Dim myCell As Range With ActiveSheet Set myRng = .Range("t10:t25") End With myStr = "" For Each myCell In myRng.Cells If IsEmpty(myCell) Then myStr = myStr & ", " & myCell.Address(0, 0) End If Next myCell If Len(myStr) 0 Then myStr = Mid(myStr, 3) Else myStr = "No blanks!" End If MsgBox myStr End Sub Sandy wrote: Hello - I have cells T10:T25. I need to return the address in a MsgBox if the cell is empty; e.g., say T11 and T15 are empty, in the messagebox it would refer specifically to T11 and T15. Any suggestions are greatly appreciated! -- Sandy -- Dave Peterson |
Return Address of Blank Cells in MsgBox
Thanks, Rowan and Dave!
Both solutions worked! -- Sandy "Sandy" wrote: Hello - I have cells T10:T25. I need to return the address in a MsgBox if the cell is empty; e.g., say T11 and T15 are empty, in the messagebox it would refer specifically to T11 and T15. Any suggestions are greatly appreciated! -- Sandy |
Return Address of Blank Cells in MsgBox
I like Rowan's better!
Sandy wrote: Thanks, Rowan and Dave! Both solutions worked! -- Sandy "Sandy" wrote: Hello - I have cells T10:T25. I need to return the address in a MsgBox if the cell is empty; e.g., say T11 and T15 are empty, in the messagebox it would refer specifically to T11 and T15. Any suggestions are greatly appreciated! -- Sandy -- Dave Peterson |
All times are GMT +1. The time now is 06:29 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com