ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   loop question in VBA (https://www.excelbanter.com/excel-programming/352087-loop-question-vba.html)

h2o[_3_]

loop question in VBA
 

I want to have a code doing the following task:
compare each pivotItem in the pivotField with ID until ID is found; i
not found, set pivotItem = "(blank)"

(ID is a user defined string)

Thanks

--
h2
-----------------------------------------------------------------------
h2o's Profile: http://www.excelforum.com/member.php...fo&userid=3098
View this thread: http://www.excelforum.com/showthread.php?threadid=50732


scruffy

loop question in VBA
 
h2o,
The following code checks to and see if a field or value is blank and if it
is place the user ID in the cell. If you set the cell as a range with slight\
modification it might accomplish what you are wanting to do.

Private Sub Workbook_Open()
ActiveSheet.Unprotect Password:="password"
If Worksheets("Sheet1").Range("User") = "" Then
Worksheets("Sheet1").Range("User") = Application.UserName
End If
ActiveSheet.Protect Password:="password"
End Sub

HTH
scruffy

"h2o" wrote:


I want to have a code doing the following task:
compare each pivotItem in the pivotField with ID until ID is found; if
not found, set pivotItem = "(blank)"

(ID is a user defined string)

Thanks!


--
h2o
------------------------------------------------------------------------
h2o's Profile: http://www.excelforum.com/member.php...o&userid=30987
View this thread: http://www.excelforum.com/showthread...hreadid=507324




All times are GMT +1. The time now is 05:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com