Error trying to populate new worksheet using macro
Solved/Closed
AmitMehta96
Posts
3
Registration date
Tuesday June 16, 2015
Status
Member
Last seen
June 30, 2015
-
Jun 29, 2015 at 01:07 PM
AmitMehta96 Posts 3 Registration date Tuesday June 16, 2015 Status Member Last seen June 30, 2015 - Jun 30, 2015 at 11:54 AM
AmitMehta96 Posts 3 Registration date Tuesday June 16, 2015 Status Member Last seen June 30, 2015 - Jun 30, 2015 at 11:54 AM
Related:
- Error trying to populate new worksheet using macro
- Transfer data from one excel worksheet to another automatically - Guide
- Network error occurred - Guide
- Cmos checksum error - Guide
- Automatically run a macro when opening a worksheet - Guide
- Spell number in excel without macro - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
January 16, 2023
549
Jun 30, 2015 at 11:46 AM
Jun 30, 2015 at 11:46 AM
Hi Amit,
Let's take a look at this part:
Cells(1, Worksheets("Data").Columns(MyCell))
Cells(Row, Column)
You got the row, which is 1.
Now for the column. MyCell is a range, so a row and a column. So you have to let Excel know you want to use the column index from MyCell. This is done which the addition of: .Column
Here is the adjusted part:
Cells(1, Worksheets("Data").Columns(MyCell.Column))
Hopefully I have relieved you of the frustration and you can start enjoying VBA again!
Best regards,
Trowa
Let's take a look at this part:
Cells(1, Worksheets("Data").Columns(MyCell))
Cells(Row, Column)
You got the row, which is 1.
Now for the column. MyCell is a range, so a row and a column. So you have to let Excel know you want to use the column index from MyCell. This is done which the addition of: .Column
Here is the adjusted part:
Cells(1, Worksheets("Data").Columns(MyCell.Column))
Hopefully I have relieved you of the frustration and you can start enjoying VBA again!
Best regards,
Trowa
Jun 30, 2015 at 11:54 AM