Link to home
Start Free TrialLog in
Avatar of Skylar
Skylar

asked on

Need help with modifying my VBA code

I need help with changing two thing in my code.

one of them is  instead of hard coded path.  
Const basePath As String = "c:\Users\Skylar\Downloads\Factory"  

Open in new window


I need help to modify this, so that instead of this fixed path.  I would get a prompt to select the path from the directory. I searched google but got confused with too many different answers that i could not put to use.

the second help i need is that my current range is static from A2 to A13 i want to change is to dynamic so that if there is more value it expands the range and if the values are not there then it collapse the range.
I do not know how to change this little code below
    Dim ws As Excel.Worksheet
    Set ws = wb.Worksheets(2)
    
    Dim rng As Excel.Range
    Set rng = ws.Range("A2:A13")

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Skylar
Skylar

ASKER

Thanks very  much to all of you.  Much appreciated.