Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Formatting data based on a cell range


Hi Guys
I wanna be able to filter my set of data and then copy the autofilte
data to a new sheet and only apply formatting to those rows tha
contain data. My function copies the data correctly but i dont know ho
to pass the "RangeOfFilteredData" value into the subroutine, AND whic
function to use to select a row range when i know the column range i
always 8, but the row range is always differing, eg the variabl
"RangeOfFilteredData"


Code
-------------------

sub blah()
Sheets("List").Select 'Contains the data
Selection.AutoFilter Field:=9, Criteria1:="<N/A" ' filtered data in sheet
Set NewOustandingRC = ActiveSheet.AutoFilter.Range ' copy fitered data
NewOustandingRC.Copy

RangeOfFilteredData = ActiveSheet.AutoFilter.Range
Sheets("Outstanding Issues").Select 'Paste data here
Range("A2").Select
Range("A2").PasteSpecial Paste:=xlPasteValuesAndNumberFormats

Formatting(RangeOfFilteredData) ' <-Run Formatting Function

'UnFilter List in first sheet
Sheets("List").Select ' LIST
Selection.AutoFilter Field:=9
End Sub

Sub Formatting(Range As Integer)
Range("A2:I??????").Select <- I know the range
Selection.Interior.ColorIndex = 37
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=MOD(ROW(),2)=1"
Selection.FormatConditions(1).Interior.ColorIndex = 36
End Sub

-------------------

--
tarn
-----------------------------------------------------------------------
tarns's Profile: http://www.excelforum.com/member.php...fo&userid=3229
View this thread: http://www.excelforum.com/showthread.php?threadid=52043

  #2   Report Post  
Posted to microsoft.public.excel.programming
KC KC is offline
external usenet poster
 
Posts: 107
Default Formatting data based on a cell range

Try replace
Range("A2:I??????")

with
Range("A2").currentregion

"tarns" wrote:


Hi Guys
I wanna be able to filter my set of data and then copy the autofilter
data to a new sheet and only apply formatting to those rows that
contain data. My function copies the data correctly but i dont know how
to pass the "RangeOfFilteredData" value into the subroutine, AND which
function to use to select a row range when i know the column range is
always 8, but the row range is always differing, eg the variable
"RangeOfFilteredData"


Code:
--------------------

sub blah()
Sheets("List").Select 'Contains the data
Selection.AutoFilter Field:=9, Criteria1:="<N/A" ' filtered data in sheet
Set NewOustandingRC = ActiveSheet.AutoFilter.Range ' copy fitered data
NewOustandingRC.Copy

RangeOfFilteredData = ActiveSheet.AutoFilter.Range
Sheets("Outstanding Issues").Select 'Paste data here
Range("A2").Select
Range("A2").PasteSpecial Paste:=xlPasteValuesAndNumberFormats

Formatting(RangeOfFilteredData) ' <-Run Formatting Function

'UnFilter List in first sheet
Sheets("List").Select ' LIST
Selection.AutoFilter Field:=9
End Sub

Sub Formatting(Range As Integer)
Range("A2:I??????").Select <- I know the range
Selection.Interior.ColorIndex = 37
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=MOD(ROW(),2)=1"
Selection.FormatConditions(1).Interior.ColorIndex = 36
End Sub

--------------------


--
tarns
------------------------------------------------------------------------
tarns's Profile: http://www.excelforum.com/member.php...o&userid=32291
View this thread: http://www.excelforum.com/showthread...hreadid=520437


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Formatting data based on a cell range


Yep, that solved everything, Been looking for about 3 weeks for that
answer and never knew currentregion existed.

thanks

KC Wrote:
Try replace
Range("A2:I??????")

with
Range("A2").currentregion

"tarns" wrote:


Hi Guys
I wanna be able to filter my set of data and then copy the

autofilter
data to a new sheet and only apply formatting to those rows that
contain data. My function copies the data correctly but i dont know

how
to pass the "RangeOfFilteredData" value into the subroutine, AND

which
function to use to select a row range when i know the column range

is
always 8, but the row range is always differing, eg the variable
"RangeOfFilteredData"


Code:
--------------------

sub blah()
Sheets("List").Select 'Contains the data
Selection.AutoFilter Field:=9, Criteria1:="<N/A" ' filtered data

in sheet
Set NewOustandingRC = ActiveSheet.AutoFilter.Range ' copy fitered

data
NewOustandingRC.Copy

RangeOfFilteredData = ActiveSheet.AutoFilter.Range
Sheets("Outstanding Issues").Select 'Paste data here
Range("A2").Select
Range("A2").PasteSpecial Paste:=xlPasteValuesAndNumberFormats

Formatting(RangeOfFilteredData) ' <-Run Formatting Function

'UnFilter List in first sheet
Sheets("List").Select ' LIST
Selection.AutoFilter Field:=9
End Sub

Sub Formatting(Range As Integer)
Range("A2:I??????").Select <- I know the range
Selection.Interior.ColorIndex = 37
Selection.FormatConditions.Add Type:=xlExpression,

Formula1:="=MOD(ROW(),2)=1"
Selection.FormatConditions(1).Interior.ColorIndex = 36
End Sub

--------------------


--
tarns

------------------------------------------------------------------------
tarns's Profile:

http://www.excelforum.com/member.php...o&userid=32291
View this thread:

http://www.excelforum.com/showthread...hreadid=520437




--
tarns
------------------------------------------------------------------------
tarns's Profile: http://www.excelforum.com/member.php...o&userid=32291
View this thread: http://www.excelforum.com/showthread...hreadid=520437

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Formatting data based on a cell range


How would to insert a formula to sum up all data in the current range if
it matches a value without hardcoding a large number like the 1000th row
of column C ??


Code:
--------------------

Sheets("List").Select
ListRowCount = ActiveSheet.UsedRange.Rows.Count 'Unfiltered Data.

Sheets("Complete Issues").Activate
Range("D7").Formula = "=COUNTIF(List!C3:C1000,C7)"


' I Wish to use something like to select a dynamic row range based on a variable .... "=COUNTIF(List!(Range("C3")(C,ListRowCount)),C 7)" ????

OR something like....

StartRow = 3
EndRow = Cells(ActiveSheet.UsedRange.Rows.Count, "C").End(xlUp).Row

But i need help cos it dont work.

--------------------


--
tarns
------------------------------------------------------------------------
tarns's Profile: http://www.excelforum.com/member.php...o&userid=32291
View this thread: http://www.excelforum.com/showthread...hreadid=520437

  #5   Report Post  
Posted to microsoft.public.excel.programming
KC KC is offline
external usenet poster
 
Posts: 107
Default Formatting data based on a cell range

I think your endrow is
range("C65536").end(xlup).row

"tarns" wrote:


How would to insert a formula to sum up all data in the current range if
it matches a value without hardcoding a large number like the 1000th row
of column C ??


Code:
--------------------

Sheets("List").Select
ListRowCount = ActiveSheet.UsedRange.Rows.Count 'Unfiltered Data.

Sheets("Complete Issues").Activate
Range("D7").Formula = "=COUNTIF(List!C3:C1000,C7)"


' I Wish to use something like to select a dynamic row range based on a variable .... "=COUNTIF(List!(Range("C3")(C,ListRowCount)),C 7)" ????

OR something like....

StartRow = 3
EndRow = Cells(ActiveSheet.UsedRange.Rows.Count, "C").End(xlUp).Row

But i need help cos it dont work.

--------------------


--
tarns
------------------------------------------------------------------------
tarns's Profile: http://www.excelforum.com/member.php...o&userid=32291
View this thread: http://www.excelforum.com/showthread...hreadid=520437


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
Data bar conditional formatting based on another cell Vivek[_2_] New Users to Excel 3 June 17th 09 08:10 AM
Formatting a cell based on other cells' data collyer3 Excel Worksheet Functions 1 December 2nd 08 05:02 PM
Formatting the color of a range of cells based on the value of one cell [email protected] Excel Worksheet Functions 3 October 20th 06 07:04 PM
How do I change cell color based upon data range within the cell? Chris Sanders Excel Worksheet Functions 1 March 6th 06 08:59 PM
Reference Data Range based on cell contents PCLIVE Charts and Charting in Excel 0 February 27th 06 03:01 PM


All times are GMT +1. The time now is 04:00 PM.

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

About Us

"It's about Microsoft Excel"