2017-04-17 10 views
0

私は次のコードで助けが必要です。デスクトップの動的パスとピボットテーブル

それは、ユーザーのデスクトップに保存したファイルを開きます(それはそう問題になっているユーザーのデスクトップを参照する方法、助けを必要とたえず変化)

はまた、新しいワークシートに保存された2つのピボットテーブルの作成と助けを必要と

Environ("UserProfile") & "\Desktop\Monthly_Report.xlsx":、

おかげ

Sub CFilter() 

' open Monthly report workbook saved on desktop of the user (changes everytime - need help to get to select desktop path) 
Workbooks.Open "C:\Users\**xxxxx**\Desktop\Monthly_Report.xlsx" 

' copy the only sheet saved in Monthly report workbook 

Sheets(1).Copy 

' Activate Workbook Macro (this contains this macro) & paste the sheet (need code for that) 
Workbooks("Macro.xlsm").Paste 

' Following code separate the contents of column E and separate the names separated by comma to separate columns starting column L 

    Dim N As Long, wf As WorksheetFunction 
    Set wf = Application.WorksheetFunction 
    N = Cells(Rows.Count, "E").End(xlUp).Row 
    Dim i As Long, j As Long, k As Long 
    For i = 1 To N 
     ary = Split(wf.Trim(Cells(i, "E").Text), ",") 
     k = 2 
     For j = LBound(ary) To UBound(ary) 
      Cells(i, k).Value = ary(j) 
      k = k + 1 
     Next j 
    Next i 



' need code here that create a pivot in another worksheet and only include rows from existing worksheet where column L is blank (need help) 
' need code here that create a pivot in another worksheet and only include rows from existing worksheet where column K is blank (need help) 


End Sub` 
+0

ようこそ。 [質問する](http://stackoverflow.com/help/how-to-ask)をお読みください。あなたは1つに非常に別々の2つの質問をしました。あなたは、より明確に定義された質問について、より多くの助けを受けるでしょう。 –

答えて

0

は、現在のユーザーのデスクトップにログインしてのパスを取得するには

+0

多くのありがとうございます。あなたはピボットを作成し、マクロブックを開いても助けてください! – ferocious12

関連する問題