what's wrong here?

Status
Not open for further replies.

earp_

Active Member
Joined
Apr 30, 2008
Messages
305
this works perfect with one workbook open
'If (valueShare1 <> 0) Then
' Worksheets("daily").Range(valueShare1 ).End(xlUp).Offset(1, 0).Value = valueShare1
'End If
but when i open another excel file with inside this code
'If (valueShare2 <> 0) Then
' Worksheets("daily").Range(valueShare2 ).End(xlUp).Offset(1, 0).Value = valueShare2
'End If
i got an error...what could it be the reason?
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Hi,

What workbook is this code refering to?
You would better add a workbook reference.

Or did you mean that both workbooks have a sheet "Daily"?

Try
Code:
ThisWorkbook.Worksheets("daily").Range(valueShare1 ).End(xlUp).Offset(1, 0).Value = valueShare1

kind regards,
Erik

EDIT: you didn't tell what the error message was, but I assumed that the code can not find the worksheet
it might not find the range which is defined by the contents of the variable valueShare1 or 2
 
Upvote 0
if i have worksheet("daily1") in worksheet1
and worksheet("daily2") in worksheet2
why do i need to put 'thisWorkbook' ?
 
Upvote 0
ok no worries, it's just that i was waiting for an answer this afternoon and I didn't know how to put my question on the top again. I thought people had lost it...but thanks anyway.
 
Upvote 0
you can bump your question to the top, by replying to your own thread
you can then add a little more information ...

as you can see this forum is really "running"
there are quite some people who look for unanswered questions (see "Quick Links" in the blue bar): so do not worry too quickly :)

see
http://www.mrexcel.com/forum/showthread.php?t=327772
 
Last edited:
Upvote 0
i thought wasn't polite to insist too much with the same thread.
I will do it with the thread that the moderator will continue.
tks again
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,213,536
Messages
6,114,211
Members
448,554
Latest member
Gleisner2

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