excel - Range not working across sheets -


i have below code in vba. issue below code range referring data sheet , in other sheet fails.

monthname = range("d5", range("d5").end(xltoright)).cells.count - 1 

can please provide me solution wherein no matter in workbook range should pick data sheet?

use

monthname = sheets("data").range("d5", sheets("data").range("d5").end(xltoright)).cells.count - 1 

btw small search on forum or google have got answer.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -