0
votes

i am new to vba, i need to take two values in a worksheet.Example below:

B10=Date........N10=: ...... P10=Feb-15....

the range of B10 have the date,N10 have the colon and P10 have date value, C10:O10 have empty cells.

so everytime i have to give

Selection.End(xlToRight).Select.

How to take this value dynamic.

Date : Feb-15 Date : Mar-15 Date : Apr-15 Date : May-15 Date : Jun-15 Date : Jul-15 Date : Aug-15 Date : Sep-15 Date : Oct-15 Date : Nov-15 Date : Dec-15

Anyone please help.

1
This is hard to understand? Can you explain in a different way?Simon

1 Answers

0
votes

Excel Macros = "bad code", they always use "selection" object and .Select method when they're not needed...

I can't really tell what you're trying to do, but if it's simply to concatenate those three cells, you can use something like:

for i = 1 to intLastRow
    with wsWorksheet
        .cells(i,1) = .cells(i,2) & .cells(i, 13) & .cells(i, 15)
    end with
next

But I don't really get the question. Why not just have a formula in a column ="Date: " & text(P10, "mmm-dd")