Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8122925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:59:27+00:00 2026-06-06T05:59:27+00:00

I will do my best to explain this. Hopefully my notes in script will

  • 0

I will do my best to explain this. Hopefully my notes in script will clarify my rambling.
In short on completion this script will flip through historical production sheets compiling select data from theses sheets into one. Within the current code I am having trouble getting the Replace() output to work correctly when identifying the next empty cell to paste to. I am attempting to limit the amount of code changes needed when I begin moving through the work books section. I hope that makes sense. “copy paste needed code to copy past with limited changes. my idea was only having to change the target column.” My skills are limited but I am learning so please feel free to give advise and feedback on method or design. at present I am stumped trying to debug the way my columnCEL variable is working in range selection. I appreciate anything constructive someone can give me. Links , info sources and so on I have been surfing this site and other for hours got a few things figured out but…

    Sub parse()
Dim strPath As String
Dim columnCEL As String
Dim lastrow As Range

'open WB to consolidate too
                        Workbooks.Open "c:\prodplan\compiled\plancon.xlsx"

Set lastrow = ActiveSheet.UsedRange.End(xlDown).Offset(1, 0)


Set objexcel = CreateObject("Excel.Application")
objexcel.Visible = True
objexcel.DisplayAlerts = False
strPath = "C:\prodplan"
Set objfso = CreateObject("Scripting.FileSystemObject")
Set objFolder = objfso.GetFolder(strPath)


'Loop through objWorkBooks
For Each objfile In objFolder.Files

    If objfso.GetExtensionName(objfile.Path) = "xlsx" Then
        Set objworkbook = objexcel.Workbooks.Open(objfile.Path)

objworkbook.Worksheets("plan").Select

 'start header dates and shifts copy from objworkbook to consolidated WB
  objworkbook.Worksheets("plan").Range("b6:p7").Select


            Selection.copy
                    Workbooks("plancon.xlsx").Worksheets("data").Range("B1").Select
                    lastrow.Select
                    ActiveCell.PasteSpecial

                    'start loop for objworkbook name copy to field in plancon corisponding with date/shift and copy/past select row data.





 objworkbook.Close False

 'Move proccesed folder to new Dir

End If
'remove msgbox after debug
 MsgBox "loop stoper remove for final application"
Next

objexcel.Quit




End Sub

"destination  WB "Plancon table structure                   
Date    shift   day Total sales Inventory   Travel
source WB NAME  Thurs   Night   3429        
source WB NAME  Fri Day 2735        
source WB NAME  Fri Night   5294        
source WB NAME  Sat Day 7672        
source WB NAME  Sat Night   0       



Source structure                    
Shift:  Thurs   Fri Fri     
Shift:  Night   Day Night       
Date:   40360   40361   40361       
Total sales 3429    2735    5294        
Inventory   1750.5045   1685.854    3374.3956       
Travel                  

Tim, Andy thank you for your time. You both are correct it should be offset(1,0).
Tim in regards to the active cell on opening the destination work book, I had set it to “a1″ but removed that with the idea it would not be needed as the code would set the Lastcell active prior to paste in the designated column which will be hard coded for each paste. I was attempting to find a way that I would not have to change the designation for the end row each time I entered a new column for paste. I believe Andy’s suggestion will simplify things for me.
I have not seen usedrange when searching though other code for examples and understanding” I have updated the code to reflect the suggestions. I have also added examples of the source and destination tables. Source table contains about 78 row labels that will be copied to destination WB in the examples format. In a perfect world a select all transpose paste would get me there. Unfortunately there is too much garbage and filtering it manually for 87+ WB was not appealing. I will have to loop with either a compare equals copy range. Or search equals copy range for each row in the source. Any advice on what one is faster/more productive? Either way thank you for your help/being a sounding board.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T05:59:32+00:00Added an answer on June 6, 2026 at 5:59 am

    Did more looking .. Found this in in a MS developer articular nowhere near the top of a search ranking. Either way it worked out.

       Dim MyColumn As String
            Dim Here As String
            Here = ActiveCell.Address
                     MyColumn = Mid(Here, InStr(Here, "$") + 1, InStr(2, Here, "$") - 2)
    lastrow = ActiveWorkbook.ActiveSheet.Range(MyColumn & "65536").End(xlUp).Offset(1, 0)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm going to try to explain this best I can I will provide more
Hopefully this explanation will make sense, but what is the best way (if it
I will try my best to explain this. I have an application that show
I will try to explain this the best way I can, but feel free
I will to try to explain this as best as I can. I have
I will try and explain this the best way I can. I have a
This is an interesting problem, and I will do my best to explain. If
Hopefully this example will illustrate my point better than simply trying to explain it:
This is a bit tricky to explain but I will try my best to
Will do my best to explain this. => I am using Fancybox and everything

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.