0
Set rng = Sheets("combine").Range("b" & (startb)":j" & (startj)).SpecialCells(xlCellTypeVisible)

i need help to pass variables into range when selecting cells.

braX
  • 11,506
  • 5
  • 20
  • 33
sunny
  • 1
  • Does this answer your question? [How to write range with variable in vba](https://stackoverflow.com/questions/67674856/how-to-write-range-with-variable-in-vba) – braX Jan 29 '22 at 23:45
  • Why don't you share the preceding code. There is not enough context. You can [edit](https://stackoverflow.com/posts/70910697/edit) your post at any time. – VBasic2008 Jan 30 '22 at 01:00
  • `... .Range("b" & startb & ":j" & startj). ...` – chris neilsen Jan 30 '22 at 02:47

1 Answers1

0

By passing variables, you can try another indexing, like

sh = Sheets("combine")
sh.Range(sh.Cells(row_x,col_x),sh.Cells(row_xx,col_yy))
Yaorong
  • 36
  • 4