PC Review


Reply
Thread Tools Rate Thread

copyToColumn

 
 
RKS
Guest
Posts: n/a
 
      27th Mar 2008
Hi all,
I hv data sheet and make another summary sheet with one criteria. I can
write code, which is show you. Problem is that its do all column in my
summary report from data sheet ( column A6 to G6) but I wants selected column
(in my summary)like A,B,D,F only. please help me what i change in my code.
and please tell me if i can increase my Criteria to 2 or 3 then what we
change.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 2 And Target.Column = 3 Then
'calculate criteria cell in case calculation mode is manual
Sheets("ProductsList").Range("Criteria").Calculate
Worksheets("ProductsList").Range("Database") _
.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("ProductsList").Range("Criteria"), _
CopyToRange:=Range("A6:g6"), Unique:=False
'calculate summary total in case calculation mode is manual
Sheets("Data Entry").Range("D2").Calculate
End If
End Sub

Thanks in advance
RKS




 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      27th Mar 2008
Try using an inputbox. You can select multiple columns by holding down the
CNTRL key.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 2 And Target.Column = 3 Then
'calculate criteria cell in case calculation mode is manual
Sheets("ProductsList").Range("Criteria").Calculate
Worksheets("ProductsList").Range("Database").Select
Set myRange = Application.InputBox(prompt:="Select Columns", Type:=8)

myRange.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("ProductsList").Range("Criteria"), _
CopyToRange:=Range("A6:g6"), Unique:=False
'calculate summary total in case calculation mode is manual
Sheets("Data Entry").Range("D2").Calculate
End If
End Sub

"RKS" wrote:

> Hi all,
> I hv data sheet and make another summary sheet with one criteria. I can
> write code, which is show you. Problem is that its do all column in my
> summary report from data sheet ( column A6 to G6) but I wants selected column
> (in my summary)like A,B,D,F only. please help me what i change in my code.
> and please tell me if i can increase my Criteria to 2 or 3 then what we
> change.
>
> Code:
> Private Sub Worksheet_Change(ByVal Target As Range)
> If Target.Row = 2 And Target.Column = 3 Then
> 'calculate criteria cell in case calculation mode is manual
> Sheets("ProductsList").Range("Criteria").Calculate
> Worksheets("ProductsList").Range("Database") _
> .AdvancedFilter Action:=xlFilterCopy, _
> CriteriaRange:=Sheets("ProductsList").Range("Criteria"), _
> CopyToRange:=Range("A6:g6"), Unique:=False
> 'calculate summary total in case calculation mode is manual
> Sheets("Data Entry").Range("D2").Calculate
> End If
> End Sub
>
> Thanks in advance
> RKS
>
>
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:36 AM.