Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
VB101
Sub Duplicate Data () ' ' NOTE: You must select the first cell in the column and ' make sure that the column is sorted before running this macro ' ScreenUpdating = False FirstItem = ActiveCell.Value SecondItem = ActiveCell.Offset(1, 0).Value Offsetcount = 1 Do While ActiveCell < "" If FirstItem = SecondItem Then ActiveCell.Offset(Offsetcount, 0).Interior.Color = RGB(255, 0, 0) ActiveCell.Offset(Offsetcount - 1, 0).Interior.Color = RGB (255, 0, 0) Offsetcount = Offsetcount + 1 SecondItem = ActiveCell.Offset(Offsetcount, 0).Value Else ActiveCell.Offset(Offsetcount, 0).Select FirstItem = ActiveCell.Value SecondItem = ActiveCell.Offset(1, 0).Value Offsetcount = 1 End If Loop ScreenUpdating = True End Sub It's been a long time. I'm trying to refresh my memory on VB. Is there a way to view the counter? I'm trying to understand each line by using debug to step through the execution. |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Put a watch on it, DebugAdd Watch...
-- __________________________________ HTH Bob "Ty" wrote in message ... VB101 Sub Duplicate Data () ' ' NOTE: You must select the first cell in the column and ' make sure that the column is sorted before running this macro ' ScreenUpdating = False FirstItem = ActiveCell.Value SecondItem = ActiveCell.Offset(1, 0).Value Offsetcount = 1 Do While ActiveCell < "" If FirstItem = SecondItem Then ActiveCell.Offset(Offsetcount, 0).Interior.Color = RGB(255, 0, 0) ActiveCell.Offset(Offsetcount - 1, 0).Interior.Color = RGB (255, 0, 0) Offsetcount = Offsetcount + 1 SecondItem = ActiveCell.Offset(Offsetcount, 0).Value Else ActiveCell.Offset(Offsetcount, 0).Select FirstItem = ActiveCell.Value SecondItem = ActiveCell.Offset(1, 0).Value Offsetcount = 1 End If Loop ScreenUpdating = True End Sub It's been a long time. I'm trying to refresh my memory on VB. Is there a way to view the counter? I'm trying to understand each line by using debug to step through the execution. |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
On Jul 29, 6:43*am, "Bob Phillips" wrote:
Put a watch on it, DebugAdd Watch... -- __________________________________ HTH Bob "Ty" wrote in message ... VB101 Sub Duplicate Data () * ' * ' NOTE: You must select the first cell in the column and * ' make sure that the column is sorted before running this macro * ' * ScreenUpdating = False * FirstItem = ActiveCell.Value * SecondItem = ActiveCell.Offset(1, 0).Value * Offsetcount = 1 * Do While ActiveCell < "" * * *If FirstItem = SecondItem Then * * * *ActiveCell.Offset(Offsetcount, 0).Interior.Color = RGB(255, 0, 0) * * * *ActiveCell.Offset(Offsetcount - 1, 0).Interior.Color = RGB (255, 0, 0) * * * *Offsetcount = Offsetcount + 1 * * * *SecondItem = ActiveCell.Offset(Offsetcount, 0).Value * * *Else * * * *ActiveCell.Offset(Offsetcount, 0).Select * * * *FirstItem = ActiveCell.Value * * * *SecondItem = ActiveCell.Offset(1, 0).Value * * * *Offsetcount = 1 * * *End If * Loop * ScreenUpdating = True End Sub It's been a long time. *I'm trying to refresh my memory on VB. *Is there a way to view the counter? I'm trying to understand each line by using debug to step through the execution.- Hide quoted text - - Show quoted text - I know this might seem easy for most reading this. I want to view the value of the counter. And this is the Offsetcount. Right?? Newbie Problem: I found it but a box came up with an Expression box. Is the Offsetcount called an expression? Note:: I used the help in Excel. But this seems greek to me, so far. expression A combination of keywords, operators, variables, and constants that yields a string, number, or object. An expression can be used to perform a calculation, manipulate characters, or test data. |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]() Cross posted he 'Yahoo! Groups' (http://tech.groups.yahoo.com/group/m.../message/35293) Ty;435112 Wrote: On Jul 29, 6:43*am, "Bob Phillips" wrote: Put a watch on it, DebugAdd Watch... -- __________________________________ HTH Bob "Ty" wrote in message ... VB101 Sub Duplicate Data () * ' * ' NOTE: You must select the first cell in the column and * ' make sure that the column is sorted before running this macro * ' * ScreenUpdating = False * FirstItem = ActiveCell.Value * SecondItem = ActiveCell.Offset(1, 0).Value * Offsetcount = 1 * Do While ActiveCell < "" * * *If FirstItem = SecondItem Then * * * *ActiveCell.Offset(Offsetcount, 0).Interior.Color = RGB(255, 0, 0) * * * *ActiveCell.Offset(Offsetcount - 1, 0).Interior.Color =RGB (255, 0, 0) * * * *Offsetcount = Offsetcount + 1 * * * *SecondItem = ActiveCell.Offset(Offsetcount, 0).Value * * *Else * * * *ActiveCell.Offset(Offsetcount, 0).Select * * * *FirstItem = ActiveCell.Value * * * *SecondItem = ActiveCell.Offset(1, 0).Value * * * *Offsetcount = 1 * * *End If * Loop * ScreenUpdating = True End Sub It's been a long time. *I'm trying to refresh my memory on VB. *Is there a way to view the counter? I'm trying to understand each line by using debug to step through the execution.- Hide quoted text - - Show quoted text - I know this might seem easy for most reading this. I want to view the value of the counter. And this is the Offsetcount. Right?? Newbie Problem: I found it but a box came up with an Expression box. Is the Offsetcount called an expression? Note:: I used the help in Excel. But this seems greek to me, so far. expression A combination of keywords, operators, variables, and constants that yields a string, number, or object. An expression can be used to perform a calculation, manipulate characters, or test data. -- p45cal *p45cal* ------------------------------------------------------------------------ p45cal's Profile: http://www.thecodecage.com/forumz/member.php?userid=558 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=120533 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
passing arguments from an excel macro to a word macro | Excel Discussion (Misc queries) |