LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Code works okay, minor adjustments wanted

Hi Howard,

Am Fri, 30 Jun 2017 14:51:04 -0700 (PDT) schrieb L. Howard:

First I want to change/adjust is to remove the last , (comma) in the MsgBox listing of cells that have a "" or (Select One) in them.

This code line adds the , (commas)
cc = cc & " " + c.Address(False, False) & ", "

and the list looks like this example in the msgbox B5, C6, G8,

Want it to look like this B5, C6, G8
(last comma is gone)

Second, instead of selecting the whole OneRng, select only the cells that are listed in the msgbox - the cc values


try:

Sub NextTab_1()
Dim bRow As Long, LRow As Long, cCnt As Long
Dim OneRng As Range, c As Range
Dim cc As String

With ActiveWorkbook.Worksheets("4. Property Information")
LRow = .Cells(.Rows.Count, "B").End(xlUp).Row
Set OneRng = .Range("B4:S" & LRow).SpecialCells(xlCellTypeVisible)

For Each c In OneRng
If c = "" Or c = "(Select One)" Then
cc = cc & ", " + c.Address(False, False)
cCnt = cCnt + 1
End If
Next

If cCnt 0 Then
.Range(Mid(cc, 2)).Select
MsgBox "There are " & cCnt & _
" cells with ""Blank"" or ""(Select One)"" in these cell address'." _
& vbCr & vbCr & Mid(cc, 2)
Else
MsgBox "All data point are positive."
Sheets("(Lists)").Visible = True
Sheets("(Lists)").Activate
End If

End With
End Sub


Regards
Claus B.
--
Windows10
Office 2016
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help wanted with Code, Please DaveM[_2_] Excel Programming 6 July 24th 07 03:24 PM
Help wanted with VBA code [email protected] Excel Programming 4 September 12th 06 09:44 PM
Newby Needs minor tweak on this VBA Macro code for Excel zulfer7 Excel Programming 1 May 21st 06 05:30 AM
VB code almost works...but can't find a minor mistake NadiaR via OfficeKB.com Excel Programming 4 March 16th 06 05:30 PM
Macro Code minor alteration please. RPTZ New Users to Excel 6 July 10th 05 05:47 AM


All times are GMT +1. The time now is 12:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"