VBA Copy Question

ionelz

Board Regular
Joined
Jan 14, 2018
Messages
248
Office Version
  1. 365
Platform
  1. Windows
Hello,
I have this line code : Sheets("Sheet1").Range("C2:C100000").Copy
So range C2:C100000

How do I say this :
Look in A1:Z1 for name "ABC" , say "ABC" is found in cell F1, and Copy that Column
Code would be :
Sheets("Sheet1").Range("F2:F100000").Copy


Thank you
 
This line can NEVER be true:
VBA Code:
If Left(LCase(cell.Value), 8) = "BOM Line" Then
"LCase" is the function for lower case. We are converting everything to lower case for the sake of comparison, since none of these would be considered the same:
"BOM Line"
"BOM LINE"
"Bom Line"


By making the entry lower case, we are standardizing it for the sake of comparion.
So the code HAS to look like:
VBA Code:
If Left(LCase(cell.Value), 8) = "bom Line" Then

Moral of the story: Don't start messing with a line of code and make changes to it if you do not fully understand what it does! Just Copy/Paste it "as-is".
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
I did not said that what you did is wrong (because I do not know), I said I can not make it work for me
And I have copy paste exactly now and still I can not make it work
Then I sent you what I have, what is working and what I would like to do
 
Upvote 0
Maybe is something wrong at Opening File Source, and looking into that, from where I want to Copy, where I want to look in A1:Z1
I hope that it is not looking in Destination file because there is no BOM Line
 
Upvote 0
Maybe is something wrong at Opening File Source, and looking into that, from where I want to Copy, where I want to look in A1:Z1
I hope that it is not looking in Destination file because there is no BOM Line
Then you need to put that code BEFORE you open the Destination file, or select the Source file before you run that part of the code.
 
Upvote 0

Forum statistics

Threads
1,215,362
Messages
6,124,502
Members
449,166
Latest member
hokjock

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