Friday 15 March 2013

optimization - Write to two cells at same time excel vba -


I need to write in a different VBA application for writing the same data in two separate cells. Can write loop and data through twice, but I was hoping to do this in one pass

This is an example of what I am doing (very complexity has been removed).

Write subdirectory set (shortcut set as writeOutDivision "Division1", 10 WriteOutDivision "Division1", 20 End sub-private sub Write Worksheet set (ByVal DivisionName, ByVal rowNumber) worksheet = CurSheet.Cells (row number, 1) with sheets ("Company Scorecard") .value = divisionName. Ball = True Finally Android 1 end sub

Is there anything that I can do to write line 10 column 1 and row 20 column 1 at the same time?

You can define a non-conjugate range and change the range of the region. For example:

  Set the worksheet dim range, especially as a dim cut sheet, set the range Sheetset = Sheets ("Company Scorecard") set rngSpecial = curSheet.Range ("A1, A3" ) RngSpecial.Value = "whatever"  

"whatever" will be written in A1 and A3.


No comments:

Post a Comment