I have values on a spreadsheet that I want formatted to a 4th decimal place, then I want to copy those values (with 0's showing) and paste them as text into another spreadsheet.
Value 1 appears as 0.008924 but should show as .0090
Value 2 appears as 1.04 but should show as 1.0400
I have 4 columns of data and 3 of them are numeric entries, the sheet the values are coming from can be formatted if needed but that formatting would need to be done via this script. Below is what I'm using to populate my new worksheet.
wsMeas: Holding original data
wsData: new document
Value 1 appears as 0.008924 but should show as .0090
Value 2 appears as 1.04 but should show as 1.0400
I have 4 columns of data and 3 of them are numeric entries, the sheet the values are coming from can be formatted if needed but that formatting would need to be done via this script. Below is what I'm using to populate my new worksheet.
wsMeas: Holding original data
wsData: new document
Code:
Windows(wbName).Activate
feat_data = wsMeas.Range(wsMeas.Cells(1, 2), wsMeas.Cells(lastr + 1, 2)).Value
nom_val = wsMeas.Range(wsMeas.Cells(1, 3), wsMeas.Cells(lastr + 1, 3)).Value
p_tol = wsMeas.Range(wsMeas.Cells(1, 4), wsMeas.Cells(lastr + 1, 4)).Value
m_tol = wsMeas.Range(wsMeas.Cells(1, 5), wsMeas.Cells(lastr + 1, 5)).Value
wsData.Activate
wsData.Range(wsData.Cells(2, 1), wsData.Cells(1 + lastr, 1)).Value = feat_data
wsData.Range(wsData.Cells(2, 2), wsData.Cells(1 + lastr, 2)).Value = pn_name
wsData.Range(wsData.Cells(2, 3), wsData.Cells(1 + lastr, 3)).Value = "Variable"
wsData.Range(wsData.Cells(2, 4), wsData.Cells(1 + lastr, 4)).Value = "Bilateral"
'wsData.Range(wsData.Cells(2, 5), wsData.Cells(1 + lastr, 5)).Value = nom_val & " +" & p_tol & " / -" & m_tol
wsData.Range(wsData.Cells(2, 6), wsData.Cells(1 + lastr, 6)).Value = nom_val
wsData.Range(wsData.Cells(2, 7), wsData.Cells(1 + lastr, 7)).Value = p_tol
wsData.Range(wsData.Cells(2, 8), wsData.Cells(1 + lastr, 8)).Value = m_tol
wsData.Range(wsData.Cells(2, 14), wsData.Cells(1 + lastr, 14)).Value = "No"
wsData.Range(wsData.Cells(2, 15), wsData.Cells(1 + lastr, 15)).Value = "No"
wsData.Range(wsData.Cells(2, 19), wsData.Cells(1 + lastr, 19)).Value = op_nam
wsData.Range(wsData.Cells(2, 20), wsData.Cells(1 + lastr, 20)).Value = "100 Percent"
wsData.Range(wsData.Cells(2, 27), wsData.Cells(1 + lastr, 27)).Value = "CMM"