Hi All,
Receiving the procedure larage while running the below code.
Request you to please point out the error i have done while compiling from the below code
Dim dist As Range, curwbk As Workbook, newwb As Workbook, filname As String, foldername As String
With Application
.ScreenUpdating = False
.DisplayAlerts = False
End With
filname = Worksheets("Inputs for LDM").Range("a1").Value
foldername = Sourcewb.Path & "\" & Worksheets("Inputs for LDM").Range("b1").Value
MkDir foldername
Sheets("Main Sheet to Enter Details").Select
Range("e4").Select
For Each dist In Range("distname")
[distname] = dist.Value
DoEvents
Set curwbk = ActiveWorkbook
Sheets(Array("Inputs for LDM", "City Level Target", " District Level Target")).Copy
Set newwb = ActiveWorkbook
With ActiveSheet.UsedRange
.Value = .Value
End With
newwb.SaveAs foldername & "\" & filname & ".xlsx", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Range("a1").Select
newwb.Close
Next
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
regards
Vinod
using excel 2007
Receiving the procedure larage while running the below code.
Request you to please point out the error i have done while compiling from the below code
Dim dist As Range, curwbk As Workbook, newwb As Workbook, filname As String, foldername As String
With Application
.ScreenUpdating = False
.DisplayAlerts = False
End With
filname = Worksheets("Inputs for LDM").Range("a1").Value
foldername = Sourcewb.Path & "\" & Worksheets("Inputs for LDM").Range("b1").Value
MkDir foldername
Sheets("Main Sheet to Enter Details").Select
Range("e4").Select
For Each dist In Range("distname")
[distname] = dist.Value
DoEvents
Set curwbk = ActiveWorkbook
Sheets(Array("Inputs for LDM", "City Level Target", " District Level Target")).Copy
Set newwb = ActiveWorkbook
With ActiveSheet.UsedRange
.Value = .Value
End With
newwb.SaveAs foldername & "\" & filname & ".xlsx", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Range("a1").Select
newwb.Close
Next
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
regards
Vinod
using excel 2007