Traversing through letters

  • Thread starter Thread starter Matt
  • Start date Start date
M

Matt

I have a module that exports data to Excel. Based on certian
conditions I want to start exporting to different columns for example:

if string1 = 1 then I want to start exporting at column "B", but if
string1 = 2 then I want to start exporting at coulmn "D". After that I
just want to keep exporting to the next column.

So my question is how do I manipulate a variable that is holding "B" or
"D" so that I can get to the next letter. I tried adding 1 to it (Like
I would in C++) and get a type mismatch.

All help is appreciated!!
 
could use .cells(row, column) when refering to the location in the worksheet
to write to; this uses the numerical location of the cell (ex .cells(4,2)
refers to B4); with A=1, B=2 ....

would look something like

objWorkbook.Worksheets(1).cells(4,2) = ValueToWriteToCell

variables can be used in the beackets .cells(CurrentRow, CurrentColumn)
 
S said:
could use .cells(row, column) when refering to the location in the worksheet
to write to; this uses the numerical location of the cell (ex .cells(4,2)
refers to B4); with A=1, B=2 ....

would look something like

objWorkbook.Worksheets(1).cells(4,2) = ValueToWriteToCell

variables can be used in the beackets .cells(CurrentRow, CurrentColumn)

THANKS!!!!

That helped greatly
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top