VBA + execution de macro sans afficher la page

alexandre84

XLDnaute Nouveau
Bonjour,

J'ai un script que je lance sur Sheet1 et qui va faire des petites bidouilles sur Sheet 2, cependant je souhaite rester sur la Sheet1 pdt l'execution pour regarder d'autres informations, si vous avez des idées ! Je suis preneur !!
Many thanks,
Alexandre
 

alexandre84

XLDnaute Nouveau
Re : VBA + execution de macro sans afficher la page

ok j'ai ca a la base

Code:
Sub histo_save()
Dim spot, data As Worksheet
Dim spotRange, eur As Range
Set spot = Workbooks("lookup_v7.xls").Worksheets("Spot")
Set data = Workbooks("lookup_v7.xls").Worksheets("Data")
nbC = 5
nbPeriod = 50
Application.ScreenUpdating = False

'record new data
    spot.Select
    spotRange = spot.Range(Cells(i + 3, j + 3), Cells(i + 3, j + 3 + nbC))

'ActiveWorkbook.PrecisionAsDisplayed = False

data.Select
'shift down data
    data.Range(Cells(i + 2, j + 1), Cells(i + 2, j + 1 + nbC)).Select
        Selection.Insert Shift:=xlDown
'input new data
    data.Cells(i + 2, j + 1) = Now
    data.Range(Cells(i + 2, j + 2), Cells(i + 2, j + 2 + nbC)) = spotRange
'delete last line
    data.Range(Cells(i + 2 + nbPeriod, j + 1), Cells(i + 2 + nbPeriod, j + 2 + nbC)).Delete
'call histo_matrix before "spot.Select"
Call histo_matrix

'--- then spot.Select
Application.ScreenUpdating = True
spot.Select
End Sub

et maintenant j'ai ca ... mais ca bug ...

Code:
Sub histo_save()
Dim spot, data As Worksheet
Dim spotRange, eur As Range
Set spot = Workbooks("lookup_v8.xls").Worksheets("Spot")
Set data = Workbooks("lookup_v8.xls").Worksheets("Data")
nbC = 5
nbPeriod = 50
Application.ScreenUpdating = False

'record new data
    spot.Select
    spotRange = spot.Range(Cells(i + 3, j + 3), Cells(i + 3, j + 3 + nbC))

'ActiveWorkbook.PrecisionAsDisplayed = False


'shift down data
    data.Range(Cells(i + 2, j + 1), Cells(i + 2, j + 1 + nbC)).Insert Shift:=xlDown

'input new data
    data.Cells(i + 2, j + 1) = Now
    data.Range(Cells(i + 2, j + 2), Cells(i + 2, j + 2 + nbC)) = spotRange
'delete last line
    data.Range(Cells(i + 2 + nbPeriod, j + 1), Cells(i + 2 + nbPeriod, j + 2 + nbC)).Delete
'call histo_matrix before "spot.Select"
Call histo_matrix

'--- then spot.Select
Application.ScreenUpdating = True
spot.Select
End Sub
 

mromain

XLDnaute Barbatruc
Re : VBA + execution de macro sans afficher la page

re,

teste avec ce code :
Code:
Sub histo_save()
Dim spot As Worksheet, data As Worksheet
Dim spotRange As Range, eur As Range
Dim nbC As Integer, nbPeriod As Integer

Set spot = Workbooks("lookup_v7.xls").Worksheets("Spot")
Set data = Workbooks("lookup_v7.xls").Worksheets("Data")
nbC = 5
nbPeriod = 50

Application.ScreenUpdating = False

'record new data
''''''''    spot.Select
    Set spotRange = spot.Range(spot.Cells(i + 3, j + 3), spot.Cells(i + 3, j + 3 + nbC))

'ActiveWorkbook.PrecisionAsDisplayed = False

''''''''data.Select
'shift down data
''''''''    data.Range(Cells(i + 2, j + 1), Cells(i + 2, j + 1 + nbC)).Select
''''''''        Selection.Insert Shift:=xlDown
    data.Range(data.Cells(i + 2, j + 1), data.Cells(i + 2, j + 1 + nbC)).Insert Shift:=xlDown
'input new data
    data.Cells(i + 2, j + 1) = Now
    data.Range(data.Cells(i + 2, j + 2), data.Cells(i + 2, j + 2 + nbC)) = spotRange
'delete last line
    data.Range(data.Cells(i + 2 + nbPeriod, j + 1), data.Cells(i + 2 + nbPeriod, j + 2 + nbC)).Delete
'call histo_matrix before "spot.Select"
Call histo_matrix

'--- then spot.Select
Application.ScreenUpdating = True
'''''''spot.Select
End Sub

a+
 

Discussions similaires

Réponses
6
Affichages
1 K
Compte Supprimé 979
C

Statistiques des forums

Discussions
311 725
Messages
2 081 944
Membres
101 849
dernier inscrit
florentMIG