Populate cells in specific columns of active row

alyssa75

Board Regular
Joined
May 14, 2007
Messages
240
Hi All -

I am trying to populate a predefined variable into a specific column of the active row (this is part of a looping code).

Here's what I am trying to do:

With ThisWorkbook
.Sheets("Temp").Cells(Rows.Count, "A").End(xlUp)(2, 1).PasteSpecial xlPasteValues
.Activate
.Range(ActiveRow, "EH").Value = MyRegion
.Range(ActiveRow, "EI").Value = myDept
End With


Any ideas are much appreciated. Thanks!
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
For one thing, you are using "Cells" syntax with "Range".
This:
Code:
Range(ActiveRow, "EH")
should be written like this:
Code:
Cells(ActiveRow, "EH")
or
Code:
Range("EH" & ActiveRow)

Also, is "ActiveRow" a variable you have defined somewhere? If not, I don't think it will work. If you want the active row, you need this:
Code:
ActiveCell.Row

There may be other problems with your code. I cannot tell if you are trying to apply this to a single row, or a whole range.
 
Upvote 0
Thank you. I was able to use your tips to modify the code and it is now doing exactly as it should! Thanks much!
 
Upvote 0

Forum statistics

Threads
1,224,550
Messages
6,179,459
Members
452,915
Latest member
hannnahheileen

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