Skip to main content
added 209 characters in body
Source Link
Jeremy
  • 409
  • 3
  • 12

I have a bit of problem working with range variable. for example, I can directly do assignment on a range of cells like this:

Range("B1:B10").Value = Range("A1:A10").Value

However, is there a concise way to do increment of range of values then assignment, following is what i mean but resulted in type-mismatch error

Range("A1:A10").Value = Range("A1:A10").Value + 1 

Hope notEdit: Ultimately what i want to use loop hereimplement is a scroll_button, when _UP is clicked, all the cells in the range increase value by 1, when _Down is clicked, all the cells in the range decrease value by 1. ThanksWhat's the most efficient way to do this?

I have a bit of problem working with range variable. for example, I can directly do assignment on a range of cells like this:

Range("B1:B10").Value = Range("A1:A10").Value

However, is there a concise way to do increment of range of values then assignment, following is what i mean but resulted in type-mismatch error

Range("A1:A10").Value = Range("A1:A10").Value + 1 

Hope not to use loop here. Thanks

I have a bit of problem working with range variable. for example, I can directly do assignment on a range of cells like this:

Range("B1:B10").Value = Range("A1:A10").Value

However, is there a concise way to do increment of range of values then assignment, following is what i mean but resulted in type-mismatch error

Range("A1:A10").Value = Range("A1:A10").Value + 1 

Edit: Ultimately what i want to implement is a scroll_button, when _UP is clicked, all the cells in the range increase value by 1, when _Down is clicked, all the cells in the range decrease value by 1. What's the most efficient way to do this?

Source Link
Jeremy
  • 409
  • 3
  • 12

Is there a concise way to do Range("A1:A10").Value = Range("A1:A10").Value + 1 in vba

I have a bit of problem working with range variable. for example, I can directly do assignment on a range of cells like this:

Range("B1:B10").Value = Range("A1:A10").Value

However, is there a concise way to do increment of range of values then assignment, following is what i mean but resulted in type-mismatch error

Range("A1:A10").Value = Range("A1:A10").Value + 1 

Hope not to use loop here. Thanks