VBA - Copy & Paste

MartinST

Board Regular
Joined
Jun 22, 2010
Messages
101
I have a workbook, lets assume Workbook 1 that contains data in column B (Range B1:B30, not all rows will necessarily contain text but that is my default range) that I Copy & Paste into Workbook 2,3 and 4 by using the following code.

HTML:
Application.Goto .Range("B" & Rows.Count).End(xlUp).Offset(1), True
    End With
     Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
The problem that I experience now is the following, If I have copied data (Text) in Range B1:B30 and paste that into workbook 2, the next time that I ran the Macro, VBA sees that there is text up to row 30 in Workbook 2 which is not true, the rows let say B1:B10 contains text and Rows B11:B30 is empty. VBA runs down to Row B31 and paste the next round of text there.

If I delete Range B11:B30 prior to running the Macro, then it works perfectly. What am I doing wrong?
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Thanks VoG for the reply and help. The copied cells do not contain any formulas it is plain text, but the macro from jonmo1 on the reference thread does the trick.

HTML:
Sub ClearNullStrings()
Selection.Value = Selection.Value
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,536
Messages
6,179,402
Members
452,909
Latest member
VickiS

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top