Wednesday 15 June 2011

excel - shtDestination based on referenced cell -


It may be quick for anyone who knows I appreciate any help ...

I have this code:

  Worksheet as a slow shtSource dim shtDestination as a worksheet dim nSourceRow as long, nDestRow as long as set in shtSource = Sheets ( "Forecast Opex") shtDestination = Sheets ("Opex Pers Sala Admi") for NSestrow = 46 nDestRow = 2 to 97 shtDestination.Cells (nDestRow, 3) = shtSource.Cells (nSourceRow, 2). Value 'NewForecast nSourceRow = nSourceRow + 1 Next nDestRow   

. ..and works fine ... the thing is that I need to create a sheet called "opex purse sala adami" which varies depending on the name in the other room (x h5). The content of that cell varies, depending on certain conditions that indicate the sheet to use the ad destination.

Comment

UPDATE > sub Update_Click () dim shtSource worksheet dim As long as the worksheet dims nSourceRow shtDestination, set shtSource = Sheets ("Base") as long as nDestRow shtDestination = Sheets (Sheets ("Base"). Category ("L21")) '... Try the code below

  • For the loop, the counter variable

      sub-testing () decreased as a worksheet short shorter source as shtDestination There is no need to increase the vertite dim NSOSR, as long as, nDestRow set shtSource = Sheets ("Sheet1") as a long set shtDestination = Sheets (sheets ("& lt; sheet name";) range (" H5 ") nSourceRow = 46 nDestRow = 2 to 97 ShtDestination.Cells (nDestRow, 3) = shtSource.Cells (nSourceRow, 2). Value Next nDestRow End Sub    

No comments:

Post a Comment