Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,886
Default How to update values on cells in visible range only

Hi

My brain will not function this morning. Here's the problem.
I am displaying a worksheet to the user with a set of transactions that
are to be selected if the goods have been received.
This is being filtered by a column not visible to the user, setting
autofilter for "Waiting".
Several non essential columns are being hidden, and I am inserting a
temporary column, with a list of checkboxes for the range visible, so
the user can tick items that have been received.
They may wish to apply a further filter to narrow the subset of
transactions to allow them to more easily see which are to be checked
off.
That filter may be released, and another applied and further checking
takes place.

When the process is complete, the user will click a button to "Update"
and I want to be able to change the status in the hidden column from
"Waiting" to "Received".
This I can do by comparing the status of the cell linked to the
checkbox, but how do I define the range to loop though, only including
those cells visible in the range the "I" have filtered by "Waiting",
having ensured that all other filters "they" might have applied have
been removed.

It's probably very simple, but I can't see it. Or, is there a better
way?


--
Regards

Roger Govier



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to update values on cells in visible range only

Unless the data is huge, why not just loop through all the cells and check
this column

Dim rng as Range
set rng = Range("A1").CurrentRegion
set rng = rng.Columns(8).Cells
for each cell in rng
if cell.Value = "Waiting" then
if cell.offset(0,2).Value = True then
cell.Value = "Received"
end if
end if
next

--
Regards,
Tom Ogilvy


"Roger Govier" wrote in message
...
Hi

My brain will not function this morning. Here's the problem.
I am displaying a worksheet to the user with a set of transactions that
are to be selected if the goods have been received.
This is being filtered by a column not visible to the user, setting
autofilter for "Waiting".
Several non essential columns are being hidden, and I am inserting a
temporary column, with a list of checkboxes for the range visible, so
the user can tick items that have been received.
They may wish to apply a further filter to narrow the subset of
transactions to allow them to more easily see which are to be checked
off.
That filter may be released, and another applied and further checking
takes place.

When the process is complete, the user will click a button to "Update"
and I want to be able to change the status in the hidden column from
"Waiting" to "Received".
This I can do by comparing the status of the cell linked to the
checkbox, but how do I define the range to loop though, only including
those cells visible in the range the "I" have filtered by "Waiting",
having ensured that all other filters "they" might have applied have
been removed.

It's probably very simple, but I can't see it. Or, is there a better
way?


--
Regards

Roger Govier





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,886
Default How to update values on cells in visible range only

Hi Tom

Thanks so much for your response., which I received on return from
lunch.
You have brought the brain back into gear. I was being rather stupid.
You are quite right, there is not so much data, that I can't do as you
suggest. There are other status values that the transactions can have,
and that was throwing me.
I have made the routine work for any of the types that it might find.
Rather then bothering about the current rgion, I have defined the range
as the used range of Status column.

I moved the test for the Offset cell value being True, up a level from
that set in your code, so of course it only flips through the rows that
have been "checked" and therefore can only be the set from the set of
cells with the staus I offer the user (in my original posting that was
"Waiting", but at other times it could be any of the other types.)
The line cell.value < "complete" is a bit superfluous, but I don't
mind a bit of "belt and braces".
Equally ,cycling through each of the possible status is a bit
inefficient, but the one macro will deal with all cases.

Sub Updatestatus()

Dim rng As Range, ws As Worksheet
Set ws = Worksheets("Awaiting Authorisation") '
With ws
lastrow = .Cells(Rows.Count, 6).End(xlUp).Row
Set rng = .Range("U12:U" & lastrow)
End With
For Each cell In rng
If cell.Offset(0, -7).Value = True Then
If cell.Value < "Complete" Then
If cell.Value = "Invoiced" Then cell.Value = "Complete"
If cell.Value = "Received" Then cell.Value = "Invoiced"
If cell.Value = "Waiting" Then cell.Value = "Received"
End If
End If
Next
End Sub

Thanks once again for gettting me kick started.
I think the brain is now functioning on 3 cylinders!!! Must have been
the wine last night<bg

--
Regards

Roger Govier


"Tom Ogilvy" wrote in message
...
Unless the data is huge, why not just loop through all the cells and
check
this column

Dim rng as Range
set rng = Range("A1").CurrentRegion
set rng = rng.Columns(8).Cells
for each cell in rng
if cell.Value = "Waiting" then
if cell.offset(0,2).Value = True then
cell.Value = "Received"
end if
end if
next

--
Regards,
Tom Ogilvy


"Roger Govier" wrote in message
...
Hi

My brain will not function this morning. Here's the problem.
I am displaying a worksheet to the user with a set of transactions
that
are to be selected if the goods have been received.
This is being filtered by a column not visible to the user, setting
autofilter for "Waiting".
Several non essential columns are being hidden, and I am inserting a
temporary column, with a list of checkboxes for the range visible, so
the user can tick items that have been received.
They may wish to apply a further filter to narrow the subset of
transactions to allow them to more easily see which are to be checked
off.
That filter may be released, and another applied and further checking
takes place.

When the process is complete, the user will click a button to
"Update"
and I want to be able to change the status in the hidden column from
"Waiting" to "Received".
This I can do by comparing the status of the cell linked to the
checkbox, but how do I define the range to loop though, only
including
those cells visible in the range the "I" have filtered by "Waiting",
having ensured that all other filters "they" might have applied have
been removed.

It's probably very simple, but I can't see it. Or, is there a better
way?


--
Regards

Roger Govier







Reply
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
Possible to change/update values in range of cells by X% ? Tom McLean Excel Discussion (Misc queries) 10 March 18th 10 05:30 PM
COPY PASTE VALUES ONLY FROM/ON VISIBLE CELLS FARAZ QURESHI Excel Discussion (Misc queries) 6 April 29th 09 01:32 PM
Sum Unique Values Across SpecialCellType Visible Range. Mark Excel Programming 1 September 15th 05 03:20 PM
Sum only visible cells within a range. Jason Kendall Excel Programming 4 July 14th 05 05:18 PM
Trying to select the visible range of cells Selector Excel Programming 1 February 1st 04 08:40 PM


All times are GMT +1. The time now is 11:33 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"