1 more question if I may, how do I get the macro to run apon refresh so I
dont have to manually execute the macro after the data is retrieved from my
SQL query?
--
Neall
"Neall" wrote:
> Hey again Kevin, it worked for only 1 row it was wierd because I had put a
> value in an empty row (for testing) within the range when I used >= 30 the
> row that was changed was 40 even thought within the 'A' column there are
> values between 1 and 237.
>
> Thanks again for your help on this
>
>
> --
> Neall
>
>
> "Kevin B" wrote:
>
> > SEe if this works for you:
> > ******************************************************
> > Sub HighlighRowII()
> >
> > Dim dblVal As Double
> > Dim lngRowOffset As Long
> > Dim strCurrentRow As String
> > Dim l As Long
> >
> > Range("A4").Select
> > dblVal = ActiveCell.Value
> >
> > For l = 4 To 120
> > dblVal = Range("A" & l).Value
> > If dblVal = 30 Then Rows(CStr(l)).Interior.Color = vbBlue
> > Next l
> >
> > End Sub
> > ******************************************************
> > --
> > Kevin Backmann
> >
> >
> > "Neall" wrote:
> >
> > > Ok did that and whats happening now is its highlighting all rows above A4
> > > which are my column headers and title.
> > >
> > >
> > > --
> > > Neall
> > >
> > >
> > > "Kevin B" wrote:
> > >
> > > > Don't select the entire column, just select A4. The lngRowOffset variable
> > > > will count off the rows, incrementing by one each time a cell is evaluated.
> > > > Change Range("A4:A120").Select
> > > > to
> > > > Range("A4").Select
> > > >
> > > > --
> > > > Kevin Backmann
> > > >
> > > >
> > > > "Neall" wrote:
> > > >
> > > > > Hey Kevin, I tried this (and maybe I did it wrong) and it turned half of the
> > > > > rows (up to 35 even though values in the row had 30 - 34 as well) and all my
> > > > > column headers and title yellow, plus it seem to of skipped every 2nd row
> > > > >
> > > > > This is what I put in
> > > > >
> > > > > Sub HighlightRow()
> > > > >
> > > > > Dim dblVal As Double
> > > > > Dim lngRowOffset As Long
> > > > > Dim strCurrentRow As String
> > > > > Range("A4:A120").Select < > > > > > want to have evaluated --->>
> > > > > dblVal = ActiveCell.Value
> > > > >
> > > > > Do While dblVal <> 0
> > > > > strCurrentRow = CStr(lngRowOffset + 1)
> > > > > If dblVal = 30 Then Rows(strCurrentRow).Interior.Color = vbBlue
> > > > > lngRowOffset = lngRowOffset + 1
> > > > > dblVal = ActiveCell.Offset(lngRowOffset).Value
> > > > > Loop
> > > > >
> > > > > End Sub
> > > > >
> > > > > Any suggestions, Thanks in advance
> > > > > --
> > > > > Neall
> > > > >
> > > > >
> > > > > "Kevin B" wrote:
> > > > >
> > > > > > In the workbook you want to do the highlighting in press Alt + F11 to open
> > > > > > the Visual Basic Editor. In the VBE menu, click INSERT and select MODULE.
> > > > > >
> > > > > > In your newly minted module, paste the text that is between the line of
> > > > > > asterisks.
> > > > > >
> > > > > > To execute the code directly from the module, press F5. To run it from the
> > > > > > workbook press Alt + F8, select the macro named HighlightRow and click the
> > > > > > RUN command button on the right side of the dialog box.
> > > > > >
> > > > > > The macro assumes that the active sheet is the sheet you wish the
> > > > > > highlighting to be done in.
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Kevin Backmann
> > > > > >
> > > > > >
> > > > > > "Neall" wrote:
> > > > > >
> > > > > > > Is this something I can past right into the excel Formula bar or VB related?
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Neall
> > > > > > >
> > > > > > >
> > > > > > > "Kevin B" wrote:
> > > > > > >
> > > > > > > > Save a copy of your workbook and in the back up copy see if the following
> > > > > > > > code does the trick for you:
> > > > > > > > *************************************************
> > > > > > > > Sub HighlightRow()
> > > > > > > >
> > > > > > > > Dim dblVal As Double
> > > > > > > > Dim lngRowOffset As Long
> > > > > > > > Dim strCurrentRow As String
> > > > > > > > Range("X1").Select
> > > > > > > > dblVal = ActiveCell.Value
> > > > > > > >
> > > > > > > > Do While dblVal <> 0
> > > > > > > > strCurrentRow = CStr(lngRowOffset + 1)
> > > > > > > > If dblVal > 30 Then Rows(strCurrentRow).Interior.Color = vbYellow
> > > > > > > > lngRowOffset = lngRowOffset + 1
> > > > > > > > dblVal = ActiveCell.Offset(lngRowOffset).Value
> > > > > > > > Loop
> > > > > > > >
> > > > > > > > End Sub
> > > > > > > > *************************************************
> > > > > > > > --
> > > > > > > > Kevin Backmann
> > > > > > > >
> > > > > > > >
> > > > > > > > "Neall" wrote:
> > > > > > > >
> > > > > > > > > Good day all;
> > > > > > > > >
> > > > > > > > > I am not sure if conditional formatting can do this but I want to select my
> > > > > > > > > entire sheet and state that;
> > > > > > > > >
> > > > > > > > > IF any cell in Column X is >=30 then highlight corresponding Row (yellow)
> > > > > > > > >
> > > > > > > > > Can this be done?
> > > > > > > > >
> > > > > > > > > Thanks in advance
> > > > > > > > > --
> > > > > > > > > Neall
> > > > > > > > >