ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Having trouble pasting to first empty cell (https://www.excelbanter.com/excel-programming/430523-having-trouble-pasting-first-empty-cell.html)

ToddEZ

Having trouble pasting to first empty cell
 
I am trying to paste data to the right most empty cell on row 32, starting in
column B. Here is what I got so far:


Dim FirstEmpty6 As Range
Dim StartCell6 As Range

With ActiveSheet
Set StartCell6 = .Range("b32")
If IsEmpty(StartCell6.Value) Then
Set FirstEmpty6 = StartCell6
ElseIf IsEmpty(StartCell6.Offset(0, 1).Value) Then
Set FirstEmpty6 = StartCell6.Offset(0, 1)
Else
Set FirstEmpty6 = StartCell6.End(xlToRight).Offset(0, 1)

FirstEmpty6.Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False

End If
End With

-----------------------------------------------------------------------------
Less Spam Better enjoyable experience
Visit : news://spacesst.com

Gary Keramidas

Having trouble pasting to first empty cell
 
you don't have anything to paste.

i used a1 in this example. watch for wordwrap in the posting.

Sub test()
Dim FirstEmpty6 As Range
Dim StartCell6 As Range

With ActiveSheet
Set StartCell6 = .Range("b32")
If IsEmpty(StartCell6.Value) Then
Set FirstEmpty6 = StartCell6
ElseIf IsEmpty(StartCell6.Offset(0, 1).Value) Then
Set FirstEmpty6 = StartCell6.Offset(0, 1)
Else
Set FirstEmpty6 = StartCell6.End(xlToRight).Offset(0, 1)
Range("A1").Copy
FirstEmpty6.PasteSpecial
Paste:=xlPasteValuesAndNumberFormats, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
End With
End Sub

--

Gary Keramidas
Excel 2003


"ToddEZ" wrote in message
...
I am trying to paste data to the right most empty cell on row 32, starting
in
column B. Here is what I got so far:


Dim FirstEmpty6 As Range
Dim StartCell6 As Range

With ActiveSheet
Set StartCell6 = .Range("b32")
If IsEmpty(StartCell6.Value) Then
Set FirstEmpty6 = StartCell6
ElseIf IsEmpty(StartCell6.Offset(0, 1).Value) Then
Set FirstEmpty6 = StartCell6.Offset(0, 1)
Else
Set FirstEmpty6 = StartCell6.End(xlToRight).Offset(0, 1)

FirstEmpty6.Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False

End If
End With



-----------------------------------------------------------------------------
Less Spam Better enjoyable experience
Visit : news://spacesst.com

ToddEZ

Having trouble pasting to first empty cell
 

Unfortunately, that did not work...

Any other ideas

"Gary Keramidas" wrote:

you don't have anything to paste.

i used a1 in this example. watch for wordwrap in the posting.

Sub test()
Dim FirstEmpty6 As Range
Dim StartCell6 As Range

With ActiveSheet
Set StartCell6 = .Range("b32")
If IsEmpty(StartCell6.Value) Then
Set FirstEmpty6 = StartCell6
ElseIf IsEmpty(StartCell6.Offset(0, 1).Value) Then
Set FirstEmpty6 = StartCell6.Offset(0, 1)
Else
Set FirstEmpty6 = StartCell6.End(xlToRight).Offset(0, 1)
Range("A1").Copy
FirstEmpty6.PasteSpecial
Paste:=xlPasteValuesAndNumberFormats, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
End With
End Sub

--

Gary Keramidas
Excel 2003


"ToddEZ" wrote in message
...
I am trying to paste data to the right most empty cell on row 32, starting
in
column B. Here is what I got so far:


Dim FirstEmpty6 As Range
Dim StartCell6 As Range

With ActiveSheet
Set StartCell6 = .Range("b32")
If IsEmpty(StartCell6.Value) Then
Set FirstEmpty6 = StartCell6
ElseIf IsEmpty(StartCell6.Offset(0, 1).Value) Then
Set FirstEmpty6 = StartCell6.Offset(0, 1)
Else
Set FirstEmpty6 = StartCell6.End(xlToRight).Offset(0, 1)

FirstEmpty6.Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False

End If
End With




marcus[_3_]

Having trouble pasting to first empty cell
 
Hi Toddez

How about if you are pasting to one cell to the end of a column you
use this.

Take Care

Marcus

Sub PastetoLC()
Dim i As Integer
Dim lc As Integer

lc = Cells(1, 2).End(xlToRight).Column + 1
' Change A1 to relevant copy area.
Range("A1").Value Range(Cells(32, lc), Cells(32, lc)).Value


End Sub

marcus[_3_]

Having trouble pasting to first empty cell
 
Sorry try this.

Sub PastetoLC()
Dim i As Integer
Dim lc As Integer

lc = Cells(1, 2).End(xlToRight).Column + 1
Range(Cells(1, lc), Cells(1, lc)).Value = Range("A1").Value

End Sub

Gary Keramidas

Having trouble pasting to first empty cell
 

what are you trying to paste?

--

Gary Keramidas
Excel 2003


"ToddEZ" wrote in message
...
Unfortunately, that did not work...

Any other ideas

"Gary Keramidas" wrote:

you don't have anything to paste.

i used a1 in this example. watch for wordwrap in the posting.

Sub test()
Dim FirstEmpty6 As Range
Dim StartCell6 As Range

With ActiveSheet
Set StartCell6 = .Range("b32")
If IsEmpty(StartCell6.Value) Then
Set FirstEmpty6 = StartCell6
ElseIf IsEmpty(StartCell6.Offset(0, 1).Value) Then
Set FirstEmpty6 = StartCell6.Offset(0, 1)
Else
Set FirstEmpty6 = StartCell6.End(xlToRight).Offset(0,
1)
Range("A1").Copy
FirstEmpty6.PasteSpecial
Paste:=xlPasteValuesAndNumberFormats, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
End With
End Sub

--

Gary Keramidas
Excel 2003


"ToddEZ" wrote in message
...
I am trying to paste data to the right most empty cell on row 32,
starting
in
column B. Here is what I got so far:


Dim FirstEmpty6 As Range
Dim StartCell6 As Range

With ActiveSheet
Set StartCell6 = .Range("b32")
If IsEmpty(StartCell6.Value) Then
Set FirstEmpty6 = StartCell6
ElseIf IsEmpty(StartCell6.Offset(0, 1).Value) Then
Set FirstEmpty6 = StartCell6.Offset(0, 1)
Else
Set FirstEmpty6 = StartCell6.End(xlToRight).Offset(0, 1)

FirstEmpty6.Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False

End If
End With





Gary Keramidas

Having trouble pasting to first empty cell
 


it copies whatever is in A1 to the first empty cell in row 32 for me.

Sub test()
Dim FirstEmpty6 As Range
Dim StartCell6 As Range

With ActiveSheet
Set StartCell6 = .Range("b32")
If IsEmpty(StartCell6.Value) Then
Set FirstEmpty6 = StartCell6
ElseIf IsEmpty(StartCell6.Offset(0, 1).Value) Then
Set FirstEmpty6 = StartCell6.Offset(0, 1)
Else
Set FirstEmpty6 = StartCell6.End(xlToRight).Offset(0, 1)
Range("A1").Copy ' change this
FirstEmpty6.PasteSpecial xlPasteValuesAndNumberFormats
End If
End With
End Sub
--

Gary Keramidas
Excel 2003


"Gary Keramidas" <GKeramidasAtMSN.com wrote in message
...
you don't have anything to paste.

i used a1 in this example. watch for wordwrap in the posting.

Sub test()
Dim FirstEmpty6 As Range
Dim StartCell6 As Range

With ActiveSheet
Set StartCell6 = .Range("b32")
If IsEmpty(StartCell6.Value) Then
Set FirstEmpty6 = StartCell6
ElseIf IsEmpty(StartCell6.Offset(0, 1).Value) Then
Set FirstEmpty6 = StartCell6.Offset(0, 1)
Else
Set FirstEmpty6 = StartCell6.End(xlToRight).Offset(0, 1)
Range("A1").Copy
FirstEmpty6.PasteSpecial
Paste:=xlPasteValuesAndNumberFormats, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
End With
End Sub

--

Gary Keramidas
Excel 2003


"ToddEZ" wrote in message
...
I am trying to paste data to the right most empty cell on row 32, starting
in
column B. Here is what I got so far:


Dim FirstEmpty6 As Range
Dim StartCell6 As Range

With ActiveSheet
Set StartCell6 = .Range("b32")
If IsEmpty(StartCell6.Value) Then
Set FirstEmpty6 = StartCell6
ElseIf IsEmpty(StartCell6.Offset(0, 1).Value) Then
Set FirstEmpty6 = StartCell6.Offset(0, 1)
Else
Set FirstEmpty6 = StartCell6.End(xlToRight).Offset(0, 1)

FirstEmpty6.Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False

End If
End With




ToddEZ

Having trouble pasting to first empty cell
 


I'm still hacving problems. The cell I'm trying to copy is on a different
sheet. does this matter?

Dim FirstEmpty6 As Range
Dim StartCell6 As Range

With ActiveSheet
Set StartCell6 = .Range("b32")
If IsEmpty(StartCell6.Value) Then
Set FirstEmpty6 = StartCell6
ElseIf IsEmpty(StartCell6.Offset(0, 1).Value) Then
Set FirstEmpty6 = StartCell6.Offset(0, 1)
Else
Set FirstEmpty6 = StartCell6.End(xlToRight).Offset(0, 1)
Sheets("DAILY POLL").Range("c53:c62").Copy
FirstEmpty6.PasteSpecial
Paste:=xlPasteValuesAndNumberFormats, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
End With



"Gary Keramidas" wrote:


it copies whatever is in A1 to the first empty cell in row 32 for me.

Sub test()
Dim FirstEmpty6 As Range
Dim StartCell6 As Range

With ActiveSheet
Set StartCell6 = .Range("b32")
If IsEmpty(StartCell6.Value) Then
Set FirstEmpty6 = StartCell6
ElseIf IsEmpty(StartCell6.Offset(0, 1).Value) Then
Set FirstEmpty6 = StartCell6.Offset(0, 1)
Else
Set FirstEmpty6 = StartCell6.End(xlToRight).Offset(0, 1)
Range("A1").Copy ' change this
FirstEmpty6.PasteSpecial xlPasteValuesAndNumberFormats
End If
End With
End Sub
--

Gary Keramidas
Excel 2003


"Gary Keramidas" <GKeramidasAtMSN.com wrote in message
...
you don't have anything to paste.

i used a1 in this example. watch for wordwrap in the posting.

Sub test()
Dim FirstEmpty6 As Range
Dim StartCell6 As Range

With ActiveSheet
Set StartCell6 = .Range("b32")
If IsEmpty(StartCell6.Value) Then
Set FirstEmpty6 = StartCell6
ElseIf IsEmpty(StartCell6.Offset(0, 1).Value) Then
Set FirstEmpty6 = StartCell6.Offset(0, 1)
Else
Set FirstEmpty6 = StartCell6.End(xlToRight).Offset(0, 1)
Range("A1").Copy
FirstEmpty6.PasteSpecial
Paste:=xlPasteValuesAndNumberFormats, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
End With
End Sub

--

Gary Keramidas
Excel 2003


"ToddEZ" wrote in message
...
I am trying to paste data to the right most empty cell on row 32, starting
in
column B. Here is what I got so far:


Dim FirstEmpty6 As Range
Dim StartCell6 As Range

With ActiveSheet
Set StartCell6 = .Range("b32")
If IsEmpty(StartCell6.Value) Then
Set FirstEmpty6 = StartCell6
ElseIf IsEmpty(StartCell6.Offset(0, 1).Value) Then
Set FirstEmpty6 = StartCell6.Offset(0, 1)
Else
Set FirstEmpty6 = StartCell6.End(xlToRight).Offset(0, 1)

FirstEmpty6.Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False

End If
End With





Gary Keramidas

Having trouble pasting to first empty cell
 

your code works for me.


Sub test()
Dim FirstEmpty6 As Range
Dim StartCell6 As Range

With ActiveSheet
Set StartCell6 = .Range("b32")
If IsEmpty(StartCell6.Value) Then
Set FirstEmpty6 = StartCell6
ElseIf IsEmpty(StartCell6.Offset(0, 1).Value) Then
Set FirstEmpty6 = StartCell6.Offset(0, 1)
Else
Set FirstEmpty6 = StartCell6.End(xlToRight).Offset(0, 1)
Sheets("DAILY POLL").Range("c53:c62").Copy
FirstEmpty6.PasteSpecial
Paste:=xlPasteValuesAndNumberFormats, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
End With
End Sub

Gary Keramidas
Excel 2003


"ToddEZ" wrote in message
...

I'm still hacving problems. The cell I'm trying to copy is on a different
sheet. does this matter?

Dim FirstEmpty6 As Range
Dim StartCell6 As Range

With ActiveSheet
Set StartCell6 = .Range("b32")
If IsEmpty(StartCell6.Value) Then
Set FirstEmpty6 = StartCell6
ElseIf IsEmpty(StartCell6.Offset(0, 1).Value) Then
Set FirstEmpty6 = StartCell6.Offset(0, 1)
Else
Set FirstEmpty6 = StartCell6.End(xlToRight).Offset(0, 1)
Sheets("DAILY POLL").Range("c53:c62").Copy
FirstEmpty6.PasteSpecial
Paste:=xlPasteValuesAndNumberFormats, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
End With



"Gary Keramidas" wrote:


it copies whatever is in A1 to the first empty cell in row 32 for me.

Sub test()
Dim FirstEmpty6 As Range
Dim StartCell6 As Range

With ActiveSheet
Set StartCell6 = .Range("b32")
If IsEmpty(StartCell6.Value) Then
Set FirstEmpty6 = StartCell6
ElseIf IsEmpty(StartCell6.Offset(0, 1).Value) Then
Set FirstEmpty6 = StartCell6.Offset(0, 1)
Else
Set FirstEmpty6 = StartCell6.End(xlToRight).Offset(0,
1)
Range("A1").Copy ' change this
FirstEmpty6.PasteSpecial xlPasteValuesAndNumberFormats
End If
End With
End Sub
--

Gary Keramidas
Excel 2003


"Gary Keramidas" <GKeramidasAtMSN.com wrote in message
...
you don't have anything to paste.

i used a1 in this example. watch for wordwrap in the posting.

Sub test()
Dim FirstEmpty6 As Range
Dim StartCell6 As Range

With ActiveSheet
Set StartCell6 = .Range("b32")
If IsEmpty(StartCell6.Value) Then
Set FirstEmpty6 = StartCell6
ElseIf IsEmpty(StartCell6.Offset(0, 1).Value) Then
Set FirstEmpty6 = StartCell6.Offset(0, 1)
Else
Set FirstEmpty6 = StartCell6.End(xlToRight).Offset(0,
1)
Range("A1").Copy
FirstEmpty6.PasteSpecial
Paste:=xlPasteValuesAndNumberFormats, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
End With
End Sub

--

Gary Keramidas
Excel 2003


"ToddEZ" wrote in message
...
I am trying to paste data to the right most empty cell on row 32,
starting
in
column B. Here is what I got so far:


Dim FirstEmpty6 As Range
Dim StartCell6 As Range

With ActiveSheet
Set StartCell6 = .Range("b32")
If IsEmpty(StartCell6.Value) Then
Set FirstEmpty6 = StartCell6
ElseIf IsEmpty(StartCell6.Offset(0, 1).Value) Then
Set FirstEmpty6 = StartCell6.Offset(0, 1)
Else
Set FirstEmpty6 = StartCell6.End(xlToRight).Offset(0, 1)

FirstEmpty6.Select
Selection.PasteSpecial
Paste:=xlPasteValuesAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False

End If
End With






All times are GMT +1. The time now is 11:10 PM.

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