PDA

View Full Version : VBA code and VBA loop



Melanie
11-20-2021, 09:55 AM
Hello,29168

I'm stuck on this Excel file, could you help me please?

2 problems:

-1- On Filtre.sheet, I use the function FILTER to find which lines "S21.G00.78.006" (noted in C2 "Saisie".sheet) are in DSN.sheet column A. But it's not dynamic and it doesn't work well.
I need the same result but with a VBA code in order to get the refresh in real time , but I don't know how to write it.:(

-2-
I need to copy Range("C172:C246") and insert/paste in DSN.sheet, Colum A , line 950 (the line is noted in C8 "Saisie".sheet)
then Range("D172 D246") in DSN.sheet, and insert/paste in DSN.sheet, Colum A , in the line noted in D8 "Saisie".sheet)
then Range("E172:E246") in DSN.sheet, noted in E8 "Saisie".sheet
.....
until empty

I need to "extend" this VBA code to the colums next to then. And stopped when there are empty:


Sub intégrationdansDSN()
'
' intégrationdansDSN Macro
'

'
Range("C172:C246").Select
Selection.Copy
Sheets("DSN").Select
Range("A950").Select ' A and the number of the line is in C8 saisie.sheet
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End Sub


THANKS A LOT in advance for your help.