Hi,
Can anybody help me with this?
Suppose the name (ABCD) is mentioned in range A2. There is a folder named ABCD in C:\Users\ . I want the macro to identify ABCD folder based on range A2 and save the excel sheet in that folder.
Thanks
Hi,
Can anybody help me with this?
Suppose the name (ABCD) is mentioned in range A2. There is a folder named ABCD in C:\Users\ . I want the macro to identify ABCD folder based on range A2 and save the excel sheet in that folder.
Thanks
Is not just
ActiveWorkbook.SaveAs "C:\Users\" & Environ("Username") & "\" & Activesheet.Range("A2").Value & "\" & Activeworkbook.Name
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
I have this code. But it is not saving the file in the folder.
Ok i figured it out. ThanksSub Test_Folder_Exist_With_Dir() Dim FolderPath As String Dim TestStr As String FolderPath = "C:\Users" If Right(FolderPath, 1) <> "\" Then FolderPath = FolderPath & "\" End If TestStr = ThisWorkbook.Sheets("Sheet1").Range("A2").Value On Error Resume Next TestStr = Dir(FolderPath) On Error GoTo 0 If TestStr = "" Then MsgBox "Folder doesn't exist" Else ActiveWorkbook.SaveCopyAs Filename:=FolderPath & ThisWorkbook.Sheets("Sheet1").Range("A2").Value & ".xlsm" End If End Sub
ActiveWorkbook.SaveCopyAs Filename:=FolderPath & ThisWorkbook.Sheets("Sheet1").Range("A2").Value & "\" & ThisWorkbook.Sheets("Sheet1").Range("A2").Value & ".xlsm"
Last edited by rockybalboa; 04-29-2014 at 10:42 PM.