ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Paste special2 (https://www.excelbanter.com/excel-discussion-misc-queries/162044-paste-special2.html)

Pietro

Paste special2
 
I need a code to activate a tab named "Italian",then to SELECT the first
empty row in column C ,then to paste special "Values and numbers
format",this command should paste an entire row starting from the selected
cell (the first empty cell in column C)
Is it possible?


JW[_2_]

Paste special2
 
On Oct 14, 12:51 pm, Pietro wrote:
I need a code to activate a tab named "Italian",then to SELECT the first
empty row in column C ,then to paste special "Values and numbers
format",this command should paste an entire row starting from the selected
cell (the first empty cell in column C)
Is it possible?


I am assuming that you will already have something stored to your
clipboard. Otherwise, you won't be pasting anything.
Really need more detail, but this code will take what is on the
clipboard and paste it's values and formats into the first available
row in column C and all the way over to column IV (because you said
the whole row). Like I said, a more detailed answer could be given if
more detail can be provided.

Sub pasteValuesFormats()
Dim r As Long
With Sheets("Italian")
r = .Cells(.Rows.Count, "C") _
.End(xlUp).Offset(1, 0).Row
.Range(Cells(r, "C"), Cells(r, "IV")).PasteSpecial _
Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
End With
End Sub


Gary''s Student

Paste special2
 
Hi Pietro:

Dim i As Long
Sheets("Italian").Activate
For i = 1 To Rows.Count
If Cells(i, "C").Value = "" Then
Exit For
End If
Next
Cells(i, "C").PasteSpecial Paste:=xlPasteValues
Cells(i, "C").PasteSpecial Paste:=xlPasteFormats

The quantity of cells that are pasted depends upon the Copy:

Sub pietro()
Dim i As Long
Sheets("Italian").Activate
Range("A26:H26").Copy
For i = 1 To Rows.Count
If Cells(i, "C").Value = "" Then
Exit For
End If
Next
Cells(i, "C").PasteSpecial Paste:=xlPasteValues
Cells(i, "C").PasteSpecial Paste:=xlPasteFormats
End Sub


will copy 8 cells.
--
Gary''s Student - gsnu200749


"Pietro" wrote:

I need a code to activate a tab named "Italian",then to SELECT the first
empty row in column C ,then to paste special "Values and numbers
format",this command should paste an entire row starting from the selected
cell (the first empty cell in column C)
Is it possible?



All times are GMT +1. The time now is 04:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com