Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default excel2000 pivottable macro

how to build a macro that will choose from column filed
automaticly a subject which is written also in a cell like A1
example:
the option in the column filed are "haim", "yael", "yoav"
cell A1 contains the name "yael"
the i want that the macro will choose the name "yael"

thank you
rozent
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default excel2000 pivottable macro

assume the options are listed in C1:C3 then

res = Application.Match(Range("A1").Value,Range("C1:C3") ,0)
if not iserror(res) then
msgbox Cells(res,3).Address & " contains " & Range("A1").Value
else
msgbox "Not found
End if

--
Regards,
Tom Ogilvy

"?????" wrote in message
...
how to build a macro that will choose from column filed
automaticly a subject which is written also in a cell like A1
example:
the option in the column filed are "haim", "yael", "yoav"
cell A1 contains the name "yael"
the i want that the macro will choose the name "yael"

thank you
rozent



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default excel2000 pivottable macro

hi tom
i think you did not get that the column filed is
blong to pivottable
i can choose from this column by a botton
the macro must make the choosen acording to
the content in A1

thank you
rozent

"Tom Ogilvy" wrote:

assume the options are listed in C1:C3 then

res = Application.Match(Range("A1").Value,Range("C1:C3") ,0)
if not iserror(res) then
msgbox Cells(res,3).Address & " contains " & Range("A1").Value
else
msgbox "Not found
End if

--
Regards,
Tom Ogilvy

"?????" wrote in message
...
how to build a macro that will choose from column filed
automaticly a subject which is written also in a cell like A1
example:
the option in the column filed are "haim", "yael", "yoav"
cell A1 contains the name "yael"
the i want that the macro will choose the name "yael"

thank you
rozent




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default excel2000 pivottable macro

No, I usually look for the question in the body of the message. If you put
critical information in the subject and so forth, then it may be read or
not. I assume these 3 possibilities are pivotitems for the column Field
named Field1

Sub ABCD()
Dim pvtFld As PivotField
Dim pvtItem As PivotItem

Set pvtFld = ActiveSheet.PivotTables("PivotTable1").ColumnField s("Field1")
For Each pvtItem In pvtFld.PivotItems
pvtItem.Visible = True
If pvtItem.Name < Range("A1").Value Then
pvtItem.Visible = False
End If
Next

End Sub

The above worked for me.

--
Regards,
Tom Ogilvy



"?????" wrote in message
...
hi tom
i think you did not get that the column filed is
blong to pivottable
i can choose from this column by a botton
the macro must make the choosen acording to
the content in A1

thank you
rozent

"Tom Ogilvy" wrote:

assume the options are listed in C1:C3 then

res = Application.Match(Range("A1").Value,Range("C1:C3") ,0)
if not iserror(res) then
msgbox Cells(res,3).Address & " contains " & Range("A1").Value
else
msgbox "Not found
End if

--
Regards,
Tom Ogilvy

"?????" wrote in message
...
how to build a macro that will choose from column filed
automaticly a subject which is written also in a cell like A1
example:
the option in the column filed are "haim", "yael", "yoav"
cell A1 contains the name "yael"
the i want that the macro will choose the name "yael"

thank you
rozent






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default excel2000 pivottable macro

That first one could have problem base on state of the pivottable when run.
This is a little more robust although not very efficient.

Sub ABCD()
Dim pvtFld As PivotField
Dim pvtItem As PivotItem

Set pvtFld = ActiveSheet.PivotTables("PivotTable1").ColumnField s("Field1")
For Each pvtItem In pvtFld.PivotItems
pvtItem.Visible = True
Next
For Each pvtItem In pvtFld.PivotItems
If pvtItem.Name < Range("A1").Value Then
pvtItem.Visible = False
End If
Next

End Sub


--
Regards,
Tom Ogilvy

"?????" wrote in message
...
hi tom
i think you did not get that the column filed is
blong to pivottable
i can choose from this column by a botton
the macro must make the choosen acording to
the content in A1

thank you
rozent

"Tom Ogilvy" wrote:

assume the options are listed in C1:C3 then

res = Application.Match(Range("A1").Value,Range("C1:C3") ,0)
if not iserror(res) then
msgbox Cells(res,3).Address & " contains " & Range("A1").Value
else
msgbox "Not found
End if

--
Regards,
Tom Ogilvy

"?????" wrote in message
...
how to build a macro that will choose from column filed
automaticly a subject which is written also in a cell like A1
example:
the option in the column filed are "haim", "yael", "yoav"
cell A1 contains the name "yael"
the i want that the macro will choose the name "yael"

thank you
rozent








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
Excel2000...use Ctrl-V, not Paste, in macro to Format Axis in a ch MacroPete Charts and Charting in Excel 6 March 24th 07 12:07 AM
How to set up a repeating macro to sum values in Excel2000? crankypants in Washington Excel Discussion (Misc queries) 2 October 23rd 06 09:41 PM
PivotTable, Scenarios, Macro?? Dave Wilson New Users to Excel 4 December 18th 04 12:22 PM
pivotable excel2000 macro chaim rozent Excel Programming 1 November 1st 04 02:31 PM
pivotable excel2000 macro chaim rozent Excel Programming 3 November 1st 04 05:34 AM


All times are GMT +1. The time now is 07:42 AM.

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"