Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 71
  • Last Modified:

wb.Worksheets(1).Range("A17", "B18", "R19", "S20").Value = "OK" Does not work

i want to use vba to update these non adjacent cells value to "OK"  but this method is not working

wb.Worksheets(1).Range("C17", "C18", "C19", "C20").Value = "OK"

how can i make this work?
0
excelismagic
Asked:
excelismagic
  • 2
1 Solution
 
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You should try it like this..
wb.Worksheets(1).Range("C17, C18, C19, C20").Value = "OK"

Open in new window

Though the straightforward way would be this...
wb.Worksheets(1).Range("C17:C20").Value = "OK"

Open in new window

0
 
excelismagicAuthor Commented:
can this work even if it is non adjacent cells?

liek this Range("C17, D18, R11, W27")
0
 
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Yes, it will work in that case also.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now