Avatar of 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

VBAMicrosoft ExcelMicrosoft Office

Avatar of undefined
Last Comment

8/22/2022 - Mon