Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all 50265 articles
Browse latest View live

Combo Box Autocomplete - Can't make it work for long list

$
0
0
Hello,
I've been using the autocomplete function of combo box. The function works great for data validation using list of about 20 items or so. I am having problem getting the autocomplete to work when the list gets long. Is there any rules regarding how long the list can be? Or what else could cause for the autocomplete function to be disabled?
Thank you for your help,
Emilie

Copy a row to a worksheet when cell value equals the worksheet name

$
0
0
Hello,

I have a workbook comprised of about 400 worksheets. I also have a summary page that lists tons of information that I need to automatically be sent to its respected worksheet. On the summary page I have the list of worksheet names in column A starting with cell A3. I am trying to get everything in that row to go to each specific worksheet. Is there a MACRO I can use to do this? Thanks for the help guys!!

Example

Tract date comments

1A 10/21/2013 No Comments
1B 10/21/2013 No Comments
1C 10/21/2013 No Comments
1D 10/21/2013 No Comments

worksheet names summary/ 1A/ 1B/ 1C/ 1D/

Please help diagnose my vba code involving html

$
0
0
Hello to all! I have this problem with my code, basically heres what it does > load page > get html > click button (after this some part of the pag will reload)> then get html again > then click button then a a part of the page will reload and so on repetitively... here is my code:
Code:

Sub Website_Login_Test()
 
 

 Application.ScreenUpdating = False
 Dim oHTML_Element As IHTMLElement
 Dim sURL As String
 Dim evt As Object
 On Error GoTo Err_Clear
 sURL = http://www.xmypage.secure.jsp
 Set oBrowser = New InternetExplorer
 oBrowser.Silent = True
 oBrowser.timeout = 60
 oBrowser.Navigate sURL
 oBrowser.Visible = True
 Do
 ' Wait till the Browser is loaded
 Loop Until oBrowser.READYSTATE = readystate_complete
 Set HTMLDoc = oBrowser.Document
 'HTMLDoc.all.q.Value = "search text"
 'HTMLDoc.all.Password.Value = "examplepassword&quot"
 
 

 Do While (oBrowser.Busy Or oBrowser.READYSTATE <> READYSTATE.readystate_complete)
  DoEvents
 Loop
 
 
 Call loopFiles
 Call changeFilter
 Call clickStart
 Application.Wait (Now + TimeValue("00:00:02"))
 Call noofMessages

 Application.Wait (Now + TimeValue("00:00:02"))

 Call loopFiles
 Call changeFilter2
 Call clickStart
 Application.Wait (Now + TimeValue("00:00:02"))
 Call noofMessages2
 Application.Wait (Now + TimeValue("00:00:02"))

 Call loopFiles
 Call changeFilter3
 Call clickStart
 Application.Wait (Now + TimeValue("00:00:02"))
 Call noofMessages3

the problem is , when the code runs the first click start, a part of the page will reload, but the next methods only get the 1st html values, I need to somewhat tell vba that the html has change so I can get the new values from that new html

MSG Box pop up when cell value is PASTED into excel; MSG box w/ button to trigger macro

$
0
0
I thought I had this one though fell at the final hurdle.

When certain values are pasted into a column I want a message box to pop up.

I have managed to achieve this with the code below in the worksheet code. Though this only works where I paste only that value into the column.

However the data is being copied from another spreadsheet as part of a range of cells.

When a range of cells is pasted into the spreadsheet the macro isn't triggered.

Any suggestions to improve this so that msg box appears when this value is identified.

And now to be greedy in case anyone knows if this is possible. If the message box can contain a Yes / No option with Yes triggering another macro? I'm thinking this is too much for worksheet code. Not necesary though would be nice.

Thanks all

Code:

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("E:E")) Is Nothing Then
Select Case Target.Value
Case "FB0281":
MsgBox "An LV Kiosk has been found in the materials list, click LV kiosk button to generate LV kiosk form"
Case "FB0336":
MsgBox "An LV Kiosk has been found in the materials list, click LV kiosk button to generate LV kiosk form"
Case "fb0281":
MsgBox "An LV Kiosk has been found in the materials list, click LV kiosk button to generate LV kiosk form"
Case "fb0336":
MsgBox "An LV Kiosk has been found in the materials list, click LV kiosk button to generate LV kiosk form"
End Select
End If

ws_exit:
Application.EnableEvents = True
End Sub

Applying an autofilter across multiple sheets

$
0
0
I have a column on Sheet 1 that has a filter option, when the user updates the filter I need the filter to update on multiple sheets.

The other sheets are fed by the sheet on field input with a simple formula +Sheet1!A4 for example.

I have successfully got the autofilter function working on a single sheet but unable to replicate this on the other sheets.
This is how I have applied the auto filter on sheet 1 on the view code option

Private Sub Worksheet_Change(ByVal Target As Range)

ActiveSheet.autofilter.ApplyFilter

End Sub

I have used the same code on sheet 2 etc. but it doesn't apply is this because the subsequent sheets are not actually changing?

Checking two separate Excel files for Duplicates and removing them

$
0
0
Looking for a macro that would compare two separate excel files for duplicates. The first file is a "database" and I want to compare it to another file and remove the rows of any of the duplicates in the second file. The data I want to compare is in column A on the "database" file and column B with the second file.

I would like this code to be in a third excel sheet that would prompt the user to open the two files separately (<------ I already have this part, please see the code below. So I need the comparison parts...)

Can anyone help? Would GREATLY appreciate it :)

Code:

Sub compare_data()
Dim fName As String, fName1 As String
Dim lrow As Long, lrow1 As Long, i As Long
Dim wb As Workbook, wb1 As Workbook
Dim rng As Range

Application.ScreenUpdating = False
Application.DisplayAlerts = False

'The path where it will prompt the user to open the old file (the last finished one)
ChDrive "C:"
ChDir "path..."


'Actual code prompting to select the old file
fName = Application.GetOpenFilename(FileFilter:="All files (*.*), *.*", Title:="Please open the Old Order file")
If fName = "" Then
    MsgBox "You have not selected a file."
    Exit Sub
Else
    Set wb = Workbooks.Open(fName)
    fName = ActiveWorkbook.Name
End If

'The path where it will prompt the user to open the new raw data that was pulled
ChDrive "C:"
ChDir "path..."

'Actual code prompting to select the raw data
fName1 = Application.GetOpenFilename(FileFilter:="All files (*.*), *.*", Title:="Please open the New Order file")
If fName1 = "" Then
    MsgBox "You have not selected a file."
    Exit Sub
Else
    Set wb1 = Workbooks.Open(fName1)
    fName1 = ActiveWorkbook.Name
End If

'Renaming the sheets, to change the names just change what is in quotes
wb1.Worksheets(1).Name = "Missing"
wb1.Worksheets.Add(after:=wb1.Worksheets(wb1.Worksheets.Count)).Name = "Meet"

smaller userform on top of larger userform being used as a wallpaper

$
0
0
Hello

is it possible to have two userform open one infront of the other? I have multiple userforms in an application i am trying to build. One of the userforms whenever it comes up i want to hide all that is in the background. The userform doesnt fill the entire screen, so must of the data still appears in the background, thats what i am trying to prevent.

what i was thinking of is whenever i call that userform via click event, i would run another userform in the background that would fill the entire screen with a picture and hide the data. The other userform i am working with would be on top of that larger userform acting as a wallpaper over the data i want to hide.

Is this possible?

Vlookup in different sheets comparing columns

$
0
0
Hi

Is it possible to use multiple Vlookups in one macro?
Currently running a vlookup of computer names between multiple sheets, i need to be able to match product name and computer name between sheets.
For example (Sheet 2 column B) compare it to (sheet1 column B and C)
if it gets a match then vlookup to (sheet 2 column A) to (sheet 1 column A)

Spreadsheet attached
any help appreciated
thanks
Attached Files

.Refresh BackgroundQuery:=False error

$
0
0
HI ,

can any expert help on below vba. i alway got the runtime error '1004'but sometime it is running fine. just wondering if my data link is on network drive , is it due to the long time to access the network data causing the vbba not working?

Private Sub CommandButton1_Click()

Sheets("Summary").Select
Sheets("Summary").Range("C1:S9287").Select
Selection.ClearComments
Sheets("EC").Select
Range("B2:AF9287").Select
Selection.ClearContents
Range("A1").Select

For colNum = 2 To (2 + Cells(18, 1)) '23
'MsgBox (colNum)

If ((IsEmpty(Cells(1, colNum)) = False) And (IsEmpty(Cells(2, 1)) = False)) Then

fileDest = "TEXT;\\Fslfabtools\" & Cells(1, colNum) & "-FC3000\main\bin_debug\data\" & Cells(2, 1)

'MsgBox (fileDest)
With ActiveSheet.QueryTables.Add(Connection:= _
fileDest, Destination:=Cells(2, colNum))

.Name = "System_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With


'insert comments
If Sheets("Summary").Cells(4, colNum) = True Then
For curRow = 2 To 9287
If Sheets("Summary").Cells(curRow, colNum) = False Then

If (IsEmpty(Sheets("EC").Cells(curRow, colNum)) = False) Then
texts = Sheets("EC").Cells(curRow, colNum)
'Sheets("Summary").Cells(curRow, colNum).ClearComments
Sheets("Summary").Cells(curRow, colNum).AddComment (texts)
Sheets("Summary").Cells(curRow, colNum).Comment.Shape.TextFrame.AutoSize = True
End If
End If
Next curRow
Else
'Sheets("Summary").Cells(1, colNum).AddComment ("Different Software Version")
'Sheets("Summary").Cells(1, colNum).Comment.Shape.TextFrame.AutoSize = True
End If

End If

Next colNum

Sheets("Summary").Select
Sheets("Summary").Range("A1").Select
MsgBox ("Complete!")

End Sub

[SOLVED] Automatic code to execute only if certain cell is empty

$
0
0
Hi.
Not sure what i'm doing wrong here but excel is sending me an error message. Basically what i'm trying to do is have an automatic code run only if a certain cell is empty, see below ( i made the font red where the code error refers to):
Code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("AU26") = "" Then
    If Target.Address <> "$F$14" And Target.Address <> "$E$3" And Not Target.Column > 12 Then
        On Error GoTo ErrHandler
        Application.EnableEvents = False
        Target.Formula = UCase(Target.Formula)
    End If
   
    If Target.Address(0, 0) = "E3" And Target.Value <> "" Then
        Target.Value = Application.WorksheetFunction.Proper(Target.Value)
    End If
   
    If Target.Address(0, 0) = "F8" And Target.Value <> "" Then
    Range("D22").Value = Target
    End If
   
    If Target.Address(0, 0) = "F10" And Target.Value <> "" Then
    Range("D23").Value = Target
    Range("N8").Value = Target
    Range("N8").Value = Application.WorksheetFunction.Proper(Range("N8").Value)
    End If
   
    If Target.Address(0, 0) = "F12" And Target.Value <> "" Then
    Range("D23").Value = Range("F10") & " " & Target
    Range("N8").Value = Range("F10") & " " & Target
    Range("N8").Value = Application.WorksheetFunction.Proper(Range("N8").Value)
    End If
   
    If Target.Address(0, 0) = "N8" And Target.Value <> "" Then
        Target.Value = Application.WorksheetFunction.Proper(Target.Value)
    End If
       
ErrHandler:
        Application.EnableEvents = True
        End If
End Sub

[SOLVED] VB Code to send Crtl+Alt key

$
0
0
Hello:

Every morning i am opening quite a few excel file to do my daily task.
I am using a special RoboTask to open each file by sending certain command
To open each file, i have assigned a Ctrl+Alt key with teh RoboTask and it works great.
Example:

If i press Ctrl+Alt+1 it will open specific file.
If i press Ctrl+Alt+2 it will open specific file.
If i press Ctrl+Alt+3 it will open specific file and so on.

Seems to work without problem.

Now i want to have macro button in one excel file which will have numerous button and each button will
open the specific file.

All i want is a VB Code (macro) to send Ctrl+Alt+1,Ctrl+Alt+2,Ctrl+Alt+3, etc command.

Let me Know if you have any questions.
Thanks.



Riz

Command Button to display the Windows calculator

$
0
0
Can anyone tell me if there are any problems with either of these pieces of code. When I run them from the module they both work, Sub 'Calculator' brings up the Windows calculator and doesn't open a new one each time, Sub 'Calculator1' opens a new one each time.

However, when I call 'Calculator' from my userform it does nothing unless the windows calulator is already running. 'Calculator1' works as normal.

Code:

Sub Calculator()
    Dim Program As String, TaskID As Double
    Program = "calc.exe"
    On Error Resume Next
    AppActivate "Calculator"
    If Err <> 0 Then
    Err = 0
    TaskID = Shell(Program, 1)
    If Err <> 0 Then MsgBox "Can't start " & Program
    End If
End Sub

Code:

Sub Calculator1()
    Dim Program As String
    Dim TaskID As Double
    On Error Resume Next
    Program = "calc.exe"
    TaskID = Shell(Program, 1)
    If Err <> 0 Then
    MsgBox "Can't start " & Program
    End If
End Sub

Running Clock/Automatically Filter Merged Cell Rows

$
0
0
I have attached an example workbook for reference.

I have a running clock in a merged cell like the example workbook.

1) Is it possible to compare the time in row 1 with the current time and if the current time is greater then a userform will show?

2) If that current time is greater than row 1's time the userform has a button to clear cells that contain the "A/B/C/D/Time" <----I have this figured out

3) Once the first row has cleared move the rest of the rows "up" and the process starts over again

4) If row 4 gets new data entered into it via a userform I have already working, upon clicking the button that puts user data into row 4, rows 1-4 automatically sort based on the time column (if row 4's time was 10:00 it would get moved to the top of the list to be checked against the running clock)

5) I'm sorry this is such a complex question I'm sure the code is going to be outrageous, if anyone has the time to waste on this I'd really appreciate it!

Book1.xlsm

[SOLVED] Varaible for file name or this file pathname

$
0
0
How could i get the below code to work with a variable as the file name?

Or could I use something like "thisfile" to determine where to import to.

Code:


Dim SV5 as String

SV5 = My File.xlsm

Do While fileName <> ""
    Workbooks.Open (directory & fileName)
       
    For Each sheet In Workbooks(fileName).Worksheets
        total = Workbooks("exportedCSV.csv").Worksheets.Count
        Workbooks(fileName).Worksheets(sheet.Name).Copy _
        After:=Workbooks("My File.xlsm").Worksheets(total)
        'After:=Workbooks("SV5").Worksheets(total)
       
    Next sheet
     
    Workbooks(fileName).Close
    fileName = Dir()
Loop

thanks in advance

Match string Array with InStr function

$
0
0
Hello Everyone,

I'm trying to build a list of words in an Array and have the program search a paragraph in a Textbox and look for matching words from the Array and make the next move.
Basically, the user writes a paragraph and I use a thesaurus(synonyms) for the word "change" and if the user uses one of the words in that paragraph then I use an "If Statement".
I wanted to go the Array route for speed but don't know if I'm correct.

Below is my wimpy attempt :)

Any help is greatly appreciated! Thank you!




Code:

Sub KeyFinder()
Dim BoxTextAs String

Dim MyArray As Variant
MyArray = Array("Change", "Modify", "Alter")


BoxText = UserForm1.Controls.Item("TextBox5").Text
If InStr(BoxText, MyArray) Then UserForm1.Controls.Item("CheckBox1") = True

End Sub


Same WorkSheet Change Event Code Across Multiple Sheets Help

$
0
0
Long time reader, first time poster...

Using Excel 2013 Professional on a Windows PC.

I have an Excel file with multiple sheets - each sheet is designed for individuals to make their own unique entries across a row and each row represents a complete entry. All the sheets in the workbook have identical columns.

I'm trying to create a Master Worksheet within the same file that captures entries from each of the other sheets as a live worksheet change event --- so when someone adds an entry to their individual sheet it adds the cell addresses for that row to the Master Sheet, and if they delete it, the row in the Master Sheet is cleared.

I have a WorkSheet change event code that does exactly that, the problem is that it only works for one sheet at a time. Using the same code in a different person's sheet only adds/clears the cell addresses to/from the Master Sheet if the entry is in a row that isn't the same as any other sheet (likely due to the "intersect" coding).

Is there a way to achieve this either using a variation of this current code or is there another better way to solve this.

File is attached and here's the code:

- The Master Sheet is called the "Dashboard" (Sheet3)
- "Rep sheet" is the individual person's sheet (ActiveSheet)
- Column "C" in each worksheet is the trigger for adding/subtracting a new entry

Code:

Private Sub Worksheet_Change(ByVal Target As Range)
' Adds/subtracts cell addresses of sales reps new entries to the "Dashboard" automatically
    ' Based on the contents of the "Client" cell

Dim EmptyRow As Long
Dim ClientName As String
Dim FoundEntry As Range
Dim SearchRange



ClientName = "='" & ActiveSheet.Name & "'!" & Target.Cells.Address

' Sales rep sheet - "Client" cell: If entry is cleared, then the row of linked cells on the "Dashboard" are cleared.
    If Target.Value = vbNullString Then GoTo ClearEntry
    On Error GoTo 0

' Sales rep sheet - "Client" cell: Current entry revised = Don't add new entry or change anything because cells are already linked in Datasheet:

Set SearchRange = Sheet3.Range("C7:C2000")
Set FoundEntry = SearchRange.Find(What:=Target.Address, LookIn:=xlFormulas)
      Do
    If Not FoundEntry Is Nothing Then Exit Sub
    Loop While Not FoundEntry Is Nothing


With ActiveSheet
' Sales rep sheet - "Client" cell: New entry added = add cell links to "Dashboard" sheet for entire entry row:
    If Not Intersect(Target, ActiveSheet.Range("$C$7:$C$1000")) Is Nothing And Target.Count = 1 Then

    Application.EnableEvents = False

' Finds next empty row in "Dashboard" sheet
'EmptyRow = Range("C65536").End(xlUp) '.Offset(1, 0).Row

' Copies the cell addresses of the row entry to the "Dashboard"
            'Sheet3.Range("C65536").End (xlUp)
           
            With Sheet3.Range("C65536").End(xlUp)
            ' Date
            Sheet3.Range("C65536").End(xlUp).Offset(1, -2) = "='" & ActiveSheet.Name & "'!" & Target.Cells.Offset(0, -2).Address
            ' Rep
            .Offset(1, -1) = "='" & ActiveSheet.Name & "'!" & Target.Cells.Offset(0, -1).Address
            ' Client name
            .Offset(1, 0) = "='" & ActiveSheet.Name & "'!" & Target.Cells.Offset(0, 0).Address
            ' New?
            .Offset(1, 1) = "='" & ActiveSheet.Name & "'!" & Target.Cells.Offset(0, 1).Address
            ' Bid?
            .Offset(1, 2) = "='" & ActiveSheet.Name & "'!" & Target.Cells.Offset(0, 2).Address
            ' Project description?
            .Offset(1, 3) = "='" & ActiveSheet.Name & "'!" & Target.Cells.Offset(0, 3).Address
            ' Location?
            .Offset(1, 4) = "='" & ActiveSheet.Name & "'!" & Target.Cells.Offset(0, 4).Address
            ' Award Date?
            .Offset(1, 5) = "='" & ActiveSheet.Name & "'!" & Target.Cells.Offset(0, 5).Address
            ' Start Date
            .Offset(1, 6) = "='" & ActiveSheet.Name & "'!" & Target.Cells.Offset(0, 6).Address
            ' Est $$
            .Offset(1, 7) = "='" & ActiveSheet.Name & "'!" & Target.Cells.Offset(0, 7).Address
            ' Forecast %
            .Offset(1, 8) = "='" & ActiveSheet.Name & "'!" & Target.Cells.Offset(0, 8).Address
            ' Forecast $
            .Offset(1, 9) = "='" & ActiveSheet.Name & "'!" & Target.Cells.Offset(0, 9).Address
            ' ENG hours
            .Offset(1, 10) = "='" & ActiveSheet.Name & "'!" & Target.Cells.Offset(0, 10).Address
            ' PM hours
            .Offset(1, 11) = "='" & ActiveSheet.Name & "'!" & Target.Cells.Offset(0, 11).Address
            ' Install hours
            .Offset(1, 12) = "='" & ActiveSheet.Name & "'!" & Target.Cells.Offset(0, 12).Address
            ' Program hours
            .Offset(1, 13) = "='" & ActiveSheet.Name & "'!" & Target.Cells.Offset(0, 13).Address
            ' Svc contract
            .Offset(1, 14) = "='" & ActiveSheet.Name & "'!" & Target.Cells.Offset(0, 14).Address
            ' Lost/dead
            .Offset(1, 15) = "='" & ActiveSheet.Name & "'!" & Target.Cells.Offset(0, 15).Address
            ' Reason lost/dead
            .Offset(1, 16) = "='" & ActiveSheet.Name & "'!" & Target.Cells.Offset(0, 16).Address
            End With
           
            Application.EnableEvents = True
        Else

ClearEntry:
    Set SearchRange = Sheet3.Columns("C:C")
        Do
    Set FoundEntry = SearchRange.Find(What:=ClientName, LookIn:=xlFormulas)
        If Not FoundEntry Is Nothing Then FoundEntry.EntireRow.ClearContents
        'If Not FoundEntry.Value = 0 Then FoundEntry.EntireRow.ClearContents
        Loop While Not FoundEntry Is Nothing
        End If

End With
End Sub

Any help is greatly appreciated.
Attached Files

Assigning work

$
0
0
I have a list of accounts that need to be worked by a specific number of people. I need them to be worked taking care of the oldest first and I need them assigned by the work load each person can handle. For this case I need to have Jane work 12 of the accounts and Tom 9. I need each to start at the oldest claim and work there way down. I also need Jane to work 12 sicne she is faster. This list will change daily and the number of people I have workign also changes as does the amount that each on can handle...

Claim RepAge Rep
12566 36 Jane 12
12566 33 Tom 9
12566 32
12566 32
12566 18
12566 18
12566 18
12566 16
12566 15
12566 15
12566 15
12566 15
12566 15
12566 15
12566 15
12566 15
12566 15
12566 15
12566 15
12566 15
12566 15


Is there some formula or macro that can assign the work taking in account the criteria I mentioned? Thanks.
Attached Files

Can anyone here tweek this macro for renaming Excel files based on a cell's contents?

$
0
0
Can anyone here tweek this macro for renaming Excel files based on a cell's contents?

I use it to rename all the files in a folder based on the text that exists in cell B1.
Can you add some more code which would give me a prompt to enter 7 more characters to put right before .xls?

Here is the existing VBA code.

Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer

Code:

Sub RenameAllExcelFilesInDirectory()

    With Application.FileDialog(msoFileDialogFolderPicker)
        .Show
        filepath = .SelectedItems(1)
    End With

    Set r = Workbooks.Add.Worksheets(1).Range("A1")
    StrFile = Dir(filepath & "\*.*")

    Do While Len(StrFile) > 0
        strExtension = Split(StrFile, ".")(UBound(Split(StrFile, ".")))

        Set wb = Workbooks.Open(filepath & "\" & StrFile)
        StrNewfullfilename = wb.Sheets(1).Range("B1").Value & "." & strExtension
        wb.Close

        r.Value = StrFile  'print old name
        r.Offset(, 1).Value = StrNewfullfilename 'print new name
        Set r = r.Offset(1)
        Name filepath & "\" & StrFile As filepath & "\" & StrNewfullfilename
        StrFile = Dir
    Loop

End Sub

VB Code error

$
0
0
Hello:

I need to use the code below

Code:

currentday = Sheets("Dly_Recpt").Range("C743:C743") 'File Name Date
    StoreN1 = Sheets("Dly_Recpt").Range("G743:G743")
   

'Set SrcRng = xlw1.Sheets(currentday & "_Store1_Z1_REG1").Range("A2:B61")

Set SrcRng = xlw1.Sheets(currentday & StoreN1).Range("A2:B61")

If i use the commented one above, the code will work however the other one gives error.

Need to know what am i doing wrong.

Let me Know if you have any questions.
Thanks.

Riz

Add a pivot table below an existing pivot table

$
0
0
Hi everyone. I can't seem to find a suitable solution to my problem.

Basically, I have codes to create 10 pivot tables. Each pivot table can vary in number of rows. What I would like to do is to be able to have all those pivot tables in one sheet, one after another separated by 3 rows.

Would there be some code that would help me do this? Perhaps something that would select the bottom of the pivot table, offset by 3 rows, and set this address as the destination range of the second pivot table, and vice versa?

Any assistance would be much appreciated.
Viewing all 50265 articles
Browse latest View live


Latest Images