HWV
Terugkerende gebruiker
- Lid geworden
- 19 feb 2009
- Berichten
- 1.213
Beste,
Ik heb een vraag met betreking tot het kopieeren van een sheet en opslaan op een locatie.
De onderstaande code gebruik ik hier voor:
Dit doet hij goed maar ik heb in dit blad "Bestellijst1" de volgende code staan die hij nu mee neem naar het gekopieerde sheet.
Ik wil enkel de sheet "Bestellijst1 zonder de macro er in hebben , is dit mogelijk ?"
Alweer vast bedankt voor uw medewerking
Groet HWV
Ik heb een vraag met betreking tot het kopieeren van een sheet en opslaan op een locatie.
De onderstaande code gebruik ik hier voor:
Code:
Sub Save1()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim Plaatsnaam
Set Plaatsnaam = Worksheets("Bestellijst1").Range("U9")
Dim Naam_Klant
Set Naam_Klant = Worksheets("Bestellijst1").Range("R7")
Dim Debnummer
Set Debnummer = Worksheets("Bestellijst1").Range("R6")
Dim Mydate
Mydate = Date
Dim Datumtekst
Datumtekst = CStr(Mydate)
Sheets("Bestellijst1").Select
Sheets("Bestellijst1").Copy
ChDir "P:\Bestellijsten\Bestellijsten\"
ActiveWorkbook.SaveAs Filename:="P:\Bestellijsten\Bestellijsten\" & "" & Naam_Klant & " " & Plaatsnaam & " " & Debnummer & " " & Datumtekst & ".xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False
MsgBox "Je gegevens zijn opgeslagen in de map P:\Bestellijsten\Bestellijsten", vbInformation, "Administrator mededeling"
ActiveWorkbook.Close
Sheets("Bestellijst1").Select
Call close_bestanden
Call close_wb
Application.Quit
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
Dit doet hij goed maar ik heb in dit blad "Bestellijst1" de volgende code staan die hij nu mee neem naar het gekopieerde sheet.
Ik wil enkel de sheet "Bestellijst1 zonder de macro er in hebben , is dit mogelijk ?"
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
'============================
'Artikelgegevens
'============================
If Target.Column = 2 Then
Target.Offset(, 1).Value = ""
Target.Offset(, 1).Value = Workbooks("PPP artikelbestand.xls").Sheets("Opslag").Columns(1).Find(Target.Value, , xlValues, xlWhole).Offset(, 21).Value
End If
If Target.Column = 2 Then
Target.Offset(, 15).Value = ""
Target.Offset(, 15).Value = Workbooks("PPP artikelbestand.xls").Sheets("Opslag").Columns(1).Find(Target.Value, , xlValues, xlWhole).Offset(, 27).Value
End If
'=============================
'adres gegevens
'=============================
Dim wsFrom As Variant
Set wsFrom = Workbooks("ZNP afnemer1 bewerkt.xls").Sheets("Opslag").Range("A2:BL3000")
If Target.Column = 18 Then
Application.EnableEvents = False
Target.Offset(1, 0).Value = Application.VLookup(Target.Value, wsFrom, 3, 0)
Target.Offset(2, 0).Value = Application.VLookup(Target.Value, wsFrom, 5, 0)
Target.Offset(3, 0).Value = Application.VLookup(Target.Value, wsFrom, 6, 0)
Target.Offset(3, 1).Value = Application.VLookup(Target.Value, wsFrom, 7, 0)
Target.Offset(4, 0).Value = Application.VLookup(Target.Value, wsFrom, 10, 0)
End If
Application.EnableEvents = True
'============================
'opmaak
'============================
If Target.Column <> 2 Then Exit Sub
Application.ScreenUpdating = False
Range(Cells(Target.Row, "B"), Cells(Target.Row, "AA")).Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous 'xlDouble
.Weight = xlThin 'xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous 'xlDouble
.Weight = xlThin 'xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
If Target.Column <> 2 Then Exit Sub
Application.ScreenUpdating = False
Range(Cells(Target.Row, "A"), Cells(Target.Row, "A")).Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous 'xlDouble
.Weight = xlThin 'xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous 'xlDouble
.Weight = xlThin 'xlThick
.ColorIndex = xlAutomatic
End With
If Target.Column <> 2 Then Exit Sub
Application.ScreenUpdating = False
Range(Cells(Target.Row, "AB"), Cells(Target.Row, "AB")).Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous 'xlDouble
.Weight = xlThin 'xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous 'xlDouble
.Weight = xlThin 'xlThick
.ColorIndex = xlAutomatic
End With
Target.Select
Application.ScreenUpdating = True
End Sub
Alweer vast bedankt voor uw medewerking
Groet HWV