Runtime 1004 when trying to assign value to different Sheet

noslenwerd

Board Regular
Joined
Nov 12, 2019
Messages
85
Office Version
  1. 365
I am trying to pull a value from a named range on worksheet "Drew", and write to a named range in worksheet "Bill"

I am getting a Runtime 1004 error on the bolded line below. What am I missing?

When I run this without referencing a different sheet it works fine.

See the comment in the code below

VBA Code:
Sub populatetopics()
Dim RevRow, FinalCol As Long
Dim FileLoc As String
Dim ReviewName, RevCount2 As String
Dim cel As Range
Dim shtA As Worksheet
Dim shtB As Worksheet

Set shtA = Sheets("Drew")
Set shtB = Sheets("Bill")

RevRow = 1
FinalCol = 1
    For Each cel In shtA.Range("DrewR")
        If shtA.Cells(RevRow, 1).Value <> "" Then
            ReviewName = shtA.Cells(RevRow, 1).Value
            FileLoc = shtA.Range("A19").Value & ReviewName & ".html"
           shtB.Range("BillFinal").Cells(0, FinalCol).Value = FileLoc 'This is where the 1004 error happens*************************
            RevRow = RevRow + 1
            FinalCol = FinalCol + 1
        End If
    Next cel
End Sub
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Rich (BB code):
           shtB.Range("BillFinal").Cells(0, FinalCol).Value = FileLoc 'This is where the 1004 error happens*************************

You can't have Cells with a row of 0. It has to be a positive number.
 
Upvote 0
Rich (BB code):
           shtB.Range("BillFinal").Cells(0, FinalCol).Value = FileLoc 'This is where the 1004 error happens*************************

You can't have Cells with a row of 0. It has to be a positive number.

Insert Home Simpson *DOH* gif here :)

Thanks for the second set of eyes!
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,255
Members
448,556
Latest member
peterhess2002

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