Hi supporters
The code below copy news feed from the news tab, ranging from Cell A3 to A21 & B3 to B21.
Hear is the interested part...
There are 19 rows. from row #3 to row #21.
Each row is copied and pasted into individual worksheet tab... In other words. 19 Rows to 19 worksheet tabs. (See workbook link below).
The aim for this is to create a log sheet for each tab of data...
My problem here is this:
How can I move forward, to fix this problem?
Thanks in advance.
The code below copy news feed from the news tab, ranging from Cell A3 to A21 & B3 to B21.
Hear is the interested part...
There are 19 rows. from row #3 to row #21.
Each row is copied and pasted into individual worksheet tab... In other words. 19 Rows to 19 worksheet tabs. (See workbook link below).
The aim for this is to create a log sheet for each tab of data...
My problem here is this:
- How can I prevent macro to copy and paste duplicate data into tabs?... and
- How can I adjust macro to wrap and align text to the left?
VBA Code:
Sub EXPORTONGLETS()
'VALID DECLARATION
Dim NOMFEUILLE As String 'NAME VARIABLE FOR THE HOME TAB
Dim NBLIGNES As Long ' VARIBLE NUMBER OF LINES PROVIDED IN NEWS
Dim LADATE As Date ' EXPORT DATE INDICATION
NBLIGNES = Worksheets("News").Range("A65536").End(xlUp).Row
LADATE = Format(CDate(Now), "dd/MM/yyyy")
'WE LAUNCH A LOOP ON ALL THE LINES OF THE NEWS TAB FROM LINE 2 TO THE END
For i = 3 To NBLIGNES
'RECOVER THE NAME OF THE TAB INDICATED IN COLUMN (A) OF NEWS
NOMFEUILLE = Worksheets("News").Range("A" & i)
'WITH THE DESTINATION SHEET, WE INSERT A LINE IN LINE 3 THEN WE INFORM
With Sheets(NOMFEUILLE).Activate
Rows("2:2").Select
Selection.Insert Shift:=xlDown
Worksheets(NOMFEUILLE).Range("A3").Value = LADATE
Worksheets(NOMFEUILLE).Range("B3").Value = Worksheets("News").Range("B" & i).Value
End With
'GO TO THE NEXT NEWS VALUE
Next i
With Sheets("News").Activate
End With
End Sub
How can I move forward, to fix this problem?
Thanks in advance.
australia-news-feed.xlsm
drive.google.com
Last edited by a moderator: