Copy Entire Column

rollingzep

Board Regular
Joined
Nov 18, 2013
Messages
214
Office Version
  1. 365
Platform
  1. Windows
<p>
Hi,

I am trying to copy an entire col, AU to col AP.

The issue I am facing is, I download data from an .CSV file from which data to Col AP is populated.
Col AU is an new Col which is added and it's data is derived from the values of col AT, like below.
<code>
lrow = ws.Range("V" & Rows.Count).End(xlUp).Row
ws.Range("AU2:AU" & lrow).Formula = _
"=IF(AT2= ""Equity"", ""EQ"", IF(AT2= ""Pfd"", ""EQ"", IF(AT2= ""Corp"", ""CORP"", IF(AT2= ""Govt"", ""TRSY"", IF(AT2= ""Muni"", ""MUNI"")))))"
</code>

I now want to copy entire Col AU values to AP by overwriting the existing values of AP.
I tried the usual Copy and PasteSpecial but it failed to overwrie.
</p>

1664481169541.png
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
You can probably use the following (no copy/paste needed):
VBA Code:
ws.Range("AU2:AU" & lrow).Formula = "=IF(AT2=""Equity"",""EQ"",IF(AT2=""Pfd"",""EQ"",IF(AT2=""Corp"",""CORP"",IF(AT2=""Govt"",""TRSY"",IF(AT2=""Muni"",""MUNI"")))))"
ws.Range("AP2:AP" & lrow).Value = ws.Range("AU2:AU" & lrow).Value
 
Upvote 0
Solution
You can probably use the following (no copy/paste needed):
VBA Code:
ws.Range("AU2:AU" & lrow).Formula = "=IF(AT2=""Equity"",""EQ"",IF(AT2=""Pfd"",""EQ"",IF(AT2=""Corp"",""CORP"",IF(AT2=""Govt"",""TRSY"",IF(AT2=""Muni"",""MUNI"")))))"
ws.Range("AP2:AP" & lrow).Value = ws.Range("AU2:AU" & lrow).Value
Thanks, that worked!
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,552
Members
449,088
Latest member
davidcom

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