Macro : copier la dernière cellule de la colonne

1

Bonjour, comment copier la dernière cellule d'une colonne d'une feuille sur une cellule d'une autre feuille ?

Posté le 3 septembre 2014, 15:09
par yema
Répondre
-1

Tu peux essayer quelque chose comme ça :

Sub DerniereCelluleDeLaColonne()
	'Retourne la valeur de la dernière cellule de la colonne B
	Dim DerniereCellule As String
	With ActiveSheet
		DerniereCellule = .Cells(.Rows.Count, "B").End(xlUp).Row
	End With
	
	'Recopier la valeur dans une nouvelle cellule
	Sheets("Feuil2").Range("A1").Value = DerniereCellule
End Sub
Vince Posté le 3 septembre 2014, 20:19
par Vince
0

Hello,

Pourquoi pas se faire une petite procédure avec passage d'argument :


Sub Bouton1_Clic()
  Call CopyLastCell("Feuil1", "B", "Feuil2", "A1")
End Sub

Sub CopyLastCell(NomFeuilleDépart As String, ColonneDépart As String, NomFeuilleArrivée As String, CellArrivée As String)
  Sheets(NomFeuilleArrivée).Range(CellArrivée).Value = Sheets(NomFeuilleDépart).Cells(Sheets(NomFeuilleDépart).Rows.Count, ColonneDépart).End(xlUp).Row
End Sub
mariowilli Posté le 4 septembre 2014, 08:44
par mariowilli
1

C'est la diégèse

Posté le 19 septembre 2014, 00:14
1

Copying the last cell of a column in one sheet to a cell of another sheet is possible in various ways, but the following is a standardapproach: first, select the cell from the column in the first sheet that you intend to copy. Hold down the 'Ctrl' key on your keyboard whileclicking the bottom-right corner of the cell to select the remaining cells in the column with data. Then, either right-click the selected cells and select 'Copy' or press 'Ctrl + C' on the keyboard. Subsequently, switch to the second sheet, select the cell where you intend to paste the copied data, and either right-click the cell and select 'Paste' or press 'Ctrl + V' on the keyboard. Tolocatenearby car wash services, visit incarwash.com - a free platform which offers touchless car wash locations.

Save to documentEdit

Content Improver

thomas32 Posté le 21 février, 07:29
par thomas32

Si vous n'êtes pas inscrit sur le site, vous pouvez poster librement (en tant qu'invité).
Pour cela, indiquez un pseudonyme (nom d'utilisateur) et une adresse email :